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 trialJohn Yzaguirre
22,025 PointsIf anyone is only seeing SOME thumbnails but not ALL 8 on the portfolio page
I spent a good hour on google finding out how to solve this issue. I checked my featured image about 100 times to make sure all 8 were setup properly but only 5 were showing up on the page. WOW so frustrating! But the answer is in page-portfolio.php. Hope this helps someone get through this faster than I had to!
In your $args array add another key/value pair. (posts_per_page)
<?php
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => -1
);
$query = new WP_Query( $args );
?>
Why -1 you might ask? Beats me! If someone can answer that I'd be interested to know! By the way Thanks for this great course Zac! You have such a positive enthusiasm and it has been so rewarding learning from you!
1 Answer
Shane Oliver
19,977 PointsYou use 'posts_per_page' => -1 because the -1 value means the 'offset' parameter gets ignored, resulting in all posts showing. To show any other amount you would specify the number ie 5 and the 'offset' parameter will be set.