Support

Account

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

Helping

Getting an archive-cpt.php to display custom taxonomy info.

  • Current setup:
    I have a custom post type messages
    every message has a taxonomy attached cpt_series
    the taxonomy series has custom fields of series_graphic, series_type, date_start, date_end
    (graphic is an img, type is a dropdown, date’s are both d/m/y)

    I’m attempting to build a query that will return the all of the terms of the taxonomy ‘series’ with the type ‘main’ and sort them by the date_start

    this was my attempt – it doesn’t work
    trying to learn more about WordPress query

    
    $args = array(
       'post_type'   => 'messages',
       'post_status' => 'publish',
       //trying to query the taxonomy 
       'tax_query'   => array(
          array(
             'taxonomy' => 'cpt_series',
             //trying to query the custom field
             'meta_query'	=> array(
                array(
                   'key'	 	=> 'series_type',
                   'value'	=> 'main',
                   'compare' 	=> 'IN'
                )
             )
          )
       )
    );
    

    Haven’t started tryin to figure out the sort by date yet.
    Any help in this would be great, thanks.

  • Current setup:
    I have a custom post type messages
    every message has a taxonomy attached cpt_series
    the taxonomy series has custom fields of series_graphic, series_type, date_start, date_end
    (graphic is an img, type is a dropdown, date’s are both d/m/y)

    I’m attempting to build a query that will return the all of the terms of the taxonomy ‘series’ with the type ‘main’ and sort them by the date_start

    this was my attempt – it doesn’t work
    trying to learn more about WordPress query

    
    $args = array(
       'post_type'   => 'messages',
       'post_status' => 'publish',
       //trying to query the taxonomy 
       'tax_query'   => array(
          array(
             'taxonomy' => 'cpt_series',
             //trying to query the custom field
             'meta_query'	=> array(
                array(
                   'key'	 	=> 'series_type',
                   'value'	=> 'main',
                   'compare' 	=> 'IN'
                )
             )
          )
       )
    );
    

    Haven’t started tryin to figure out the sort by date yet.
    Any help in this would be great, thanks.

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

You must be logged in to reply to this topic.