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 WordPress Theme Development Custom Homepage Templates in WordPress A Static Homepage Template

shareyourpeace
shareyourpeace
3,244 Points

Using the $num_posts code, I end up with One fewer images on the frontpage.

I use this code:

$num_posts = ( is_front_page() ) ? 4 : -1;

I end up with 3 images on the frontpage and all images on my portfolio page.

When I change it to

$num_posts = ( is_front_page() ) ? 5 : -1;

I end up with 4 images on my frontpage.

Is something incorrect with my code ?

It is what I see in the video and in the FINAL content-portfolio.php code from the project files I downloaded.

Thanks.

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

What happens when you directly hard code the number into the parameter rather than using the conditional statement. Also, do you have any products without images that may be in the loop that are being looped through but without an image?