Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. $term = get_queried_object();
  2. the_post();
  3. $wp_query = new WP_Query( array(
  4. 'post_type' => 'resource',
  5. 'tax_query' => array(
  6. array(
  7. 'taxonomy' => 'resource_types',
  8. 'field' => 'slug',
  9. 'terms' => $term->name,
  10. )),
  11. 'meta_query' => array(
  12. 'relation' => 'OR',
  13. array( //check to see if date has been filled out
  14. 'key' => 'publication_date',
  15. 'compare' => '=',
  16. 'value' => date('Y-m-d')
  17. ),
  18. array( //if no date has been added show these posts too
  19. 'key' => 'publication_date',
  20. 'value' => date('Y-m-d'),
  21. 'compare' => 'NOT EXISTS'
  22. )
  23. ),
  24. 'meta_key' => 'publication_date',
  25. 'orderby' => 'meta_value title',
  26. 'order' => 'ASC',
  27. 'paged' => $paged,
  28. 'posts_per_page' => '10',
  29. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement