Custom Post Type Posts not Displayed
-
What I thought: Create a new CPT, use default categories and tags, and CPT posts will show up like everything else. If the latest post was of CPT Articles, it would show up on the front page, first…
But no, that does not happen.
Clicking the one category to which a CPT Articles post is assigned yields everything but the CPT Articles posts!
Clicking either of the two tags to which my CPT Articles post is assigned yields anything but my CPT Article posts.
I can View the Post from the Admin panel.
I created the Custom Post Type (“Articles”) with this taxonomy:
'taxonomies' => array('category', 'post_tag'), // just use default categories and tags
and, leaving index.php, single.php and article.php in the sub-directory, I created and uploaded single-my_articles.php and archive-my_articles.php files with
<?php /* Start the Loop */ ?> <?php // VAL MOD for Custom Post Type $loop = new WP_Query( array( 'post_type' => 'my_articles', 'posts_per_page' => 10 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?>
I am unable to display any of the posts I have created using this new Articles CPT.
Full code at pastebin
I am missing something very obvious…
- The topic ‘Custom Post Type Posts not Displayed’ is closed to new replies.