Hi,
I’m trying to create and if/and statement to show data if certain sets of fields match. For example, I have field A and field B, I want to create a conditional statement that will show something only if field A has a value and field B does not. The catch is I need multiple.
This currently works;
<?php if( get_field('additional_person_1_first_name') && get_field('additional_person_1_director_role') == '' ): ?>
But this doesn’t;
<?php if( get_field('additional_person_1_first_name') && get_field('additional_person_1_director_role') == '' ) || get_field('additional_person_2_first_name') && get_field('additional_person_2_director_role') == '' ): ?>
What am I missing?
You’re IF statement is incorrect. Try:
if ( ( get_field('additional_person_1_first_name') && get_field('additional_person_1_director_role') == '' ) || ( get_field('additional_person_2_first_name') && get_field('additional_person_2_director_role') == '' ) ) :