Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMartin Švec
8,208 PointsContent of custom post type is not showing
I followed all the steps in the video to make a custom post type, but discovered that the content of my posts made this way are not showing up when viewing my page.
I found on the forum for this video that in order to make this work I have to set up the template files for your archive-{post type}.php and single-{post type}.php files in your theme.
Even after I did that, I am still not getting any results. I was then looking for an answer elsewhere on google and found out that I might need to put some query into to the code as well. I don't have any knowledge of query yet so I don't know what need to be done. Could someone please tell me what to do to make it work.
Thank you all for your answers
Martin Švec
8,208 PointsHi Rich,
I added this code I found on the internet to my child theme.
<?php
$args = array( 'post_type' => "art"); $query = new WP_Query( $args );
?>
2 Answers
Rich Bagley
25,869 PointsHi Martin,
It sounds as though you need to create the custom post type template. That should be the next video in the course and can be found here. This goes through the process step-by-step.
That should hopefully help you to choose what is shown on the page.
-Rich
Martin Švec
8,208 PointsThank you Rich,
I completed this course, but somehow managed to skip this video. Thank you for answering my silly question.
Rich Bagley
25,869 PointsNo problem. Don't forget to mark it as Best Answer if that sorted your problem :)
-Rich
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHi Martin,
Can you post your code please?
Thanks
-Rich