Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $term = get_queried_object();
- the_post();
- $wp_query = new WP_Query( array(
- 'post_type' => 'resource',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'resource_types',
- 'field' => 'slug',
- 'terms' => $term->name,
- )),
- 'meta_query' => array(
- 'relation' => 'OR',
- array( //check to see if date has been filled out
- 'key' => 'publication_date',
- 'compare' => '=',
- 'value' => date('Y-m-d')
- ),
- array( //if no date has been added show these posts too
- 'key' => 'publication_date',
- 'value' => date('Y-m-d'),
- 'compare' => 'NOT EXISTS'
- )
- ),
- 'meta_key' => 'publication_date',
- 'orderby' => 'meta_value title',
- 'order' => 'ASC',
- 'paged' => $paged,
- 'posts_per_page' => '10',
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement