Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. $query = new WP_Query( array(
  2. 'post_type' => 'books', // name of post type.
  3. 'tax_query' => array(
  4. array(
  5. 'taxonomy' => 'fiction', // taxonomy name
  6. )
  7. )
  8. ) );
  9.  
  10. while ( $query->have_posts() ) : $query->the_post();
  11. // do stuff here....
  12. endwhile;
  13.  
  14. /**
  15. * reset the orignal query
  16. * we should use this to reset wp_query
  17. */
  18. wp_reset_query();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement