ControlledChaos of Controlled Chaos Design
8/9/2016 - 6:41 PM

Include Custom Post Type Posts in Index Loop

Include Custom Post Type Posts in Index Loop

<?php

function ccd_get_cpt_posts( $query ) {
	if ( is_home() && $query->is_main_query() )
		$query->set( 'post_type', array( 'post', 'custom_post_type' ) );
	return $query;
}

add_filter( 'pre_get_posts', 'ccd_get_cpt_posts' );

?>

Include Custom Post Type Posts in Index Loop

WordPress Snippet