Home Forums Front-end Issues Retrieve taxonomy based on ACF field. Reply To: Retrieve taxonomy based on ACF field.

  • No worries, thanks for taking the time to look. It turned out my main issue was converting the array to a string, in case this is ever useful to anyone else… this worked

      echo '<div class="row mb-5"><div class="col-12"><h3>History</h3></div>';
      foreach($madein as $term)
        $a = get_field('podcast_topic', 'shows_'.$term->term_id); // get the field array
        $topicforuse = json_encode($a); // use json to convert to a string
        if (strpos($topicforuse, 'history') !== false) { //check the string for a keyword
          echo '<div class="col-6 col-md-3 col-xl-2 p-2"><a href="' . get_term_link( $term ) . '">'; 
          echo wp_get_attachment_image( get_field('podcast_category_thumb', $term), 'thumbnail', false,  array('class' => 'img-responsive rounded','style' => 'width:100%;height: auto; aspect-ratio: 1 / 1') );
          echo '</a></div>';
      echo '</div>';