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 trial

WordPress

Phil Purves
Phil Purves
9,827 Points

Anyone got past Custom Post Types in the WP Theme Devt Course?

I got stuck with the Custom Post thumbnails (featured images) not displaying on the Portfolio Page. But eventually found a workaround by exploring the 'final' files... Setting up the $num_posts variable and 'posts_per_page' as an array element (as found in the content-portfolio.php - final theme folder) solves the issue, but perhaps there's an easier way. I just wasn't getting Zac's results without those lines. He encouraged me to post my workaround here - may be helpful to someone?

The WP Theme Devt. course is excellent by the way, but lies outside of the WordPress Track for some reason. It can be found in the Library. I've found php a bit scary but Zac's learning-through-doing approach is helpful.

3 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Howdy!

Interesting that the original code isn't working for you. Had you enabled featured images in your functions.php file?

BTW, that's another vote for a PHP for WordPress Course that I would love to do in early 2015 :)

Andrew Shook
Andrew Shook
31,709 Points

Zac, I think a PHP for WordPress Course would be very helpful for the students here at treehouse. I answer questions all the time with regards to that topic.

Phil Purves
Phil Purves
9,827 Points

Hi Zac - I followed all the recommended code to the letter, including the features/thumbnail image enabling function. Strange - I just commented out the $num_posts references and it still works as it should.... it's a mystery! I wonder if anyone else had my problem

Yes +1 vote for php-for-wordpress.

Any reason why this course isn't in the Wordpress Track? btw.

Andrew Shook
Andrew Shook
31,709 Points

Phillip, I came across this discussion and was wondering if you could post the code that was giving you a problem. I'm just interested in seeing what's happening in the code. Thanks

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

It will be in the track in the next week or two. Since its replacing an older course there is a short transition time while it's in the library only before it gets added to the track. In part to let people finish working through the old course and in part to work out any kinks :)

shareyourpeace
shareyourpeace
3,244 Points

Phillip. If you want to include code use backticks ``` Required. I have not figured out how to include a 'hard' return. each of the following should be on a separate line. using ++ for ul did not work.

blank line 3 backticks block of code 3 backticks blank line

I typed out 3 backticks so it would not be in code block format For example.

<?php previous_post_link(); ?> -
<a href="<?php bloginfo('url'); ?>/portfolio">Back to Portfolio</a> - 
<?php next_post_link(); ?>
Phil Purves
Phil Purves
9,827 Points

Ah well, you see I don't know now. I just followed through the instructions and the primary Portfolio Page wouldn't show the thumbnails (at the same stage that Zac get's them to display properly). I got the same results on both an existing site and starting with a blank new site - both with Firefox and Chrome. Somehow it works now but only started working after adding the $num_posts (variable) lines ... but now when I comment them out it still works (?!). I quess it could've been down to some other minor error, that may never be discovered, unless someone else runs into the same issue. Sorry if all this has been a red herring!

Andrew Shook
Andrew Shook
31,709 Points

Ok thanks for replying, and best of luck.