У меня есть div вроде этого:
<div class="price">
<p>Price: <?php echo get_post_meta($post->ID, 'Price', true); ?></p>
</div>
<div class="m2">
<p>m^2: <?php echo get_post_meta($post->ID, 'm2', true); ?></p>
</div>
<div class="year">
<p>Year: <?php echo get_post_meta($post->ID, 'Year', true); ?></p>
</div>
<div class="rooms">
<p>Room #: <?php echo get_post_meta($post->ID, 'Rooms', true); ?></p>
</div>
Я хочу скрыть пустые поля, но мое решение не работает:
<?php if( get_field('Price') ): ?>
<p>Price ($): <?php the_field('Price'); ?></p>
<?php endif; ?>