I'm using wordpress, don't think that's relevant since this is just php but just putting that out there.
I have two subsequent if statements, and I wondered if there is a cleaner way to do this rather than nesting them.
<?php if(is_category('3')){ ?>
<?php if( get_field('the_field') ): ?>
// do action here
<?php endif; ?>
<?php endif; ?>
Is it possible to combine the two rather than nest them? I'd like to have clean code. I think this will work as is, but it looks messy.
Like could possibly something like this work?>
<?php if(is_category('3') && get_field('the_field') ): ?>
// do action here
<?php endif; ?>
Aucun commentaire:
Enregistrer un commentaire