mercredi 8 avril 2015

Multiple if else

How can i show some default code only if BOTH if statements are false ?


I've got this code -



<?php if( get_sub_field('cta_phone')): ?>
<a class="phone" href="tel:<?php the_sub_field('cta_phone');?>"><?php the_sub_field('cta_phone');?></a></span>
<?php else: ?><?php endif; ?>

<?php if( get_sub_field('cta_mobile')): ?>
<a class="phone" href="tel:<?php the_sub_field('cta_mobile');?>"><?php the_sub_field('cta_mobile');?></a></span>
<?php else: ?><?php endif; ?>

<?php else: ?>
<img src="http://my-domain/image.jpg">
<?php endif; ?>


i'm not using the else bit at the end at the moment because i only want that to show if both 'if's are fasle ?


hope that makes sense


Aucun commentaire:

Enregistrer un commentaire