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

How to Build a Wordpress Theme - No code covered for the 'display_on_homepage' checkbox in the front-page.php slider loop?

This has been a fantastic course. Thank you Zac for breaking things down in such an engaging and informative way.

I have just completed Stage 6 and it occurred to me that the slider content on the homepage is being pulled into the slider regardless of whether the 'display_on_homepage' checkbox custom field is selected or not in the 'Work' posts.

How can I run the loop in my front-page.php so that it filters according to the custom field value? That is, so that it only displays posts in the 'work' type if they contain the custom field value 'yes' for the 'display_on_homepage' field. What would be the syntax for doing this? Any pointers would be greatly appreciated.

Discovered this issue had been answered several hours before I posted - sorry! Solution is here:

https://teamtreehouse.com/forum/custom-post-type-displayonhomepage-not-working

1 Answer