Can someone know the answer about it
I have field set and i want when they are empty show some text now there is showing nothing
<div class="place-bottom-row">
<?php if(get_field('pojedynczy_wpis')):
$i = 0;
$today = date('d-m-Y'); //This has to match the format of your date field
?>
<?php while(has_sub_field('pojedynczy_wpis')): ?>
<?php if(strtotime($today) <= strtotime(get_sub_field('danie_na_dzien'))){ ?>
<?php if($i < 2){ ?>
<?php $i++; ?>
<?php the_sub_field('danie_rodzaj'); ?>
<?php the_sub_field('danie_opis'); ?>
<?php the_sub_field('danie_cena'); ?>
<?php } ?>
<?php } ?>
<?php endwhile; ?>
<?php else: ?>
<?php endif; ?>
</div><!-- place bottom row end -->
Rather than using
the_sub_field()
(whichecho
es the return value), you should use get_sub_field():This will allow you to test if there’s a value, before echoing it.