ACF true/false
-
Hi,
Created a custom posttype to get my projects. I want to select the projects which will be displayed on the homepage, so I created a Advanced Custom Field True/False. The default value is set to true, so every project will be shown.
Now when I browse to the site, I only see the boolean returned for the first project, the other ones return NULL.
Therefore I think I have to do something with a foreach loop, but don’t know how to accomplish this. Any help is appreciated…My code so far…
`<?php
/*
* Template Name: Homepage
*/
get_header(); ?><?php
$projects = array(‘post_type’ => ‘project’, );
$loop = new WP_Query($projects);
while($loop->have_posts()) : $loop->the_post();
$truefalse = get_field(‘show_on_homepage’);
?><?php
the_title();
echo ‘'; var_dump($truefalse); echo '
‘;
?><?php endwhile; ?>
<?php get_footer(); ?>
The topic ‘ACF true/false’ is closed to new replies.