I have my checkbox custom field (show_days) as values (1-7) to represent (Moo-Sun) and I tested it with an echo and it is returning the correct value. Example today is Tuesday and the echo is showing 2.
I am trying to compare it to the current date strftime("%u", time());
to only show posts that have the current day check marked. Its not working and Im wondering if I need to add an in_array
somewhere. Thanks for your help.
<?php
$days = get_field('show_days');
$date = strftime("%u", time());
if ($query->have_posts() && $days = $date ) { while( $query->have_posts() ) {
$query->the_post();
echo '<div class="onAir"><h3>Currently On Air: ';
the_title();
echo $days. '</h3></div>';
} wp_reset_postdata();
}
?>
Aucun commentaire:
Enregistrer un commentaire