Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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