I have a custom post type of Textorial with necessary template files:
- textorial-type.php
- single-textorial.php
- content-textorial.php
The idea is to have a custom layout for the post type and use infinite-scroll to pull them in. That's why I'm using content.php. I got the infinite-scroll set up,and succesfully tested with regular posts. But when pulling custom post type in on index.php:
<div id="content">
<?php
while (have_posts()) : the_post();
get_template_part( 'content', 'textorial' );
endwhile;
?>
</div>
... nothing shows up. Also no errors. But the single-textorial.php is using the same method and its content is showing. Any ideas?
Update!
on front-page.php:
<?php $args = array('post_type' => 'textorial');
$query = new WP_Query( $args );
while (have_posts() ) : the_post();
get_template_part( 'content', 'textorial' );
endwhile;
?>
But now only regular posts show up.
pre_get_posts
to set your custom post type in the main query. Also, what istexorial-type.php
textorial-type.php
is like afunctions.php
file. Remember, custom post types are excluded from the main query