I'm using the Advanced Custom Field (ACF) plugin in a Custom Post Type (CPT).
I have field group in ACF that contains a Image field and true/false field called 'home_offer'.
I'm using this ACF in a Custom Post Type called Offers.
I want to loop through the CPT Offers and check if the true/false field 'home_offer' is checked.
How do I check if the true/false field is selected.
Ive started with this WP_Query.
<div id="offers">
<?php
$offers_args = array(
'post_type' => 'Offers',
'post_per_page' => 1,
'meta_query' => array(
array(
'key' => 'home_offer',
'value' => 'on',
'compare' => '=',
'type' => 'CHAR'
);
);
);
$offers_loop = new WP_Query($offers_args);
if($offers_loop->have_posts()):
while($offers_loop->have_posts()):
$offers_loop->the_post();
$image = get_field('image');
?>
<div id="offerLeft">
<img src="<?php echo $image ?>" alt="" />
</div>
<?php
endwhile;
endif;
wp_reset_postdata();
?>
</div>