Home › Forums › ACF PRO › Perform action by value of field › Reply To: Perform action by value of field
If you have a lot of terms I would use a switch, and it depends on if your field is returning 1 term or multiple temrs. Assuming that the field is returning multiple terms.
$terms = get_field('your-tax-field');
if ($terms) {
foreach ($terms as $term) {
switch ($term->term_id) { // could also be any term value
// cases would depend on above
case 1:
// output for case 1
break;
case 2:
// output for case 2
break;
case 3:
// output for case 3
break;
// etc...
} // end switch
} // end foreach term
} // end if terms
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.