Hi,
I’m using True/false custom field to display page/post on the homepage.
If i check a post/page: it is displayed correctly.
But when i uncheck a post/page… it’s still displayed on homepage.
Somebody has an idea?
Here is my loop:
<?php
get_field('sur_la_homepage','options');
wp_reset_postdata();
$myargs = array (
'post_type' => array('post', 'page'),
'meta_key' => 'sur_la_homepage',
'value' => '1',
'compare' => '=='
);
$myquery = new WP_Query($myargs);
if($myquery->have_posts() ) :
while($myquery->have_posts() ) : $myquery->the_post();?>
...
Thank you very much
Hi @vinchoz
Thanks for the post.
I suppose you could use an if statement to check for the status of the true/false field and then display the posts of your query.
The if statement will look as follows:
<?php
if(get_field(field_name)){
//your query
}
?>