Support

Account

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