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


5,912 Points

Allison Grayce Project - Front Page Image Slider, Check box

Hi! This might be a stupid question, but I completed the "How to build a WordPress theme" and have noticed that the check box for "Display on the home page image slider" doesn't appear to be working. The slider just displays all projects on the home page.

I've gone back to try to find the video which tells you how to do it, but can't find it (I don't think it's in this one unless I've missed it!)

It would be really useful to know for a project I'm doing. Thanks

2 Answers

5,912 Points

Hi Art,

Thanks for your reply :-)

You were right that is had to be a custom query, but found the answer on the ACF documentation page! For anyone interested in how to do it ->

Go to front-page.php paste the following code into the $args array.

$args = array(
            'post_type' => 'work',
            'meta_query' => array(
                    'key' => 'display_on_the_homepage', // name of custom field
                    'value' => '"Yes"', // matches exactly "Yes"
                    'compare' => 'LIKE'

From this page on the documentation: http://www.advancedcustomfields.com/resources/field-types/checkbox/

Works now :-D