I have this piece of PHP code used in WordPress and now it shows both buttons UK and DK even if there are only data in one of them. The data for the DK uses this field name "streaming_from_shop" and the UK uses this "streaming_from_shop_uk". How can I make it show only the button with data written in the field and not show the other? And of course, show both if there are data present in both fields.
<?php
$streaming_link = get_field('streaming_from_shop');
if( $streaming_link ):
?>
<?php
setup_postdata($streaming_link);
?>
<a href="<?php the_field('streaming_from_shop'); ?>" class="buttonstream_shop" target="_blank">Stream DK</a>
<a href="<?php the_field('streaming_from_shop_uk'); ?>" class="buttonstream_shop" target="_blank">Stream UK</a>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Aucun commentaire:
Enregistrer un commentaire