Support

Account

Home Forums Front-end Issues Getting an archive-cpt.php to display custom taxonomy info Reply To: Getting an archive-cpt.php to display custom taxonomy info

  • I solved most of this, needed to query the taxonomy directly instead of querying the post for the taxonomy.

    
    $terms = get_terms(array(
       'taxonomy' => 'cpt_series',
       'hide_empty' => true,
       'meta_query'	=> array(
          array(
             'key'	   => 'series_type',
             'value'   => 'main',
             'compare' => 'LIKE'
          ),
       ),
    ));
    				
    if ( ! empty( $terms ) ) {
       echo '<ul>';
       foreach ( $terms as $term ) {
          $image = get_field('series_graphic', 'cpt_series_' . $term->term_id . '' );
          $seriesLink = get_term_link($term->term_id, $taxonomy = 'cpt_series');
          $seriesGraphic = $image['url'];
       ?>
          <li>
             <a href="<?=$seriesLink?>">
                <img src="<?=$seriesGraphic?>" />
                <?=$term->name?>
             </a>
          </li>						
     <?php					
       }
       echo '</ul>';
    } else {
       echo 'No term found.';
    }
    

    Only thing outstanding is how to sort them by the date.