multiple if statements

Am I ok to use multiple if statements like the following, or is there a better more efficient method?

while ( $actionType_query->have_posts() )
{
$actionType_query->the_post();

if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_AGF’, ‘ecosystem_nbs’)) {
$cons_a++;
}
if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_CMA’, ‘ecosystem_nbs’)) {
$cons_b++;
}
if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_FOR’, ‘ecosystem_nbs’)) {
$cons_c++;
}
if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_GRA’, ‘ecosystem_nbs’)) {
$cons_d++;

}
if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_MON’, ‘ecosystem_nbs’)) {
$cons_e++;

}
if (has_term(‘NBS_CONS’, ‘broad_type_nbs’ ) && has_term(‘NBS_RIV’, ‘ecosystem_nbs’)) {
$cons_f++;
}

}

Thanks.

Read more here:: multiple if statements

Leave a Reply

Your email address will not be published. Required fields are marked *