Support

Account

Forum Replies Created

  • 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

    <?php
      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>';
    ?>
  • Kind of, the taxonomies are:

    Shows
    Country
    Topics

    Under shows I can assign a topic, and the country (amongst other fields) via ACF. The code I added at the top allows me to display a list of Show Taxonomy items based on the country field (podcast_country) – it’s a single item so I used a text field and the query was quite easy to create.

    What I’m trying to do is list the Shows based on the ‘podcast_topic’ field, but because that’s a taxonomy it outputs as an array and I can’t figure out how to get it to work.

    shows taxonomy

  • Thanks, but I’m trying to show the ‘Shows’ taxonomy items that have ‘podcast_topic’ applied to them. Not the posts.

Viewing 4 posts - 1 through 4 (of 4 total)