Advertisement
Guest User

Untitled

a guest
Aug 8th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2. $current_cat = get_query_var('cat');
  3. // for tags use 'tag'
  4. // $current_tag = get_query_var('tag');
  5.  
  6. $args = array(
  7. 'cat' => $current_cat,
  8. // 'tag' => $current_tag,
  9. 'post_type' => 'post',
  10. 'posts_per_page' => 1
  11. );
  12.  
  13. $the_first_query = new WP_Query( $args );
  14. // The Loop
  15. while ( $the_first_query->have_posts() ) : $the_first_query->the_post();
  16. the_title();
  17. endwhile;
  18.  
  19. // Reset Post Data
  20. wp_reset_postdata();
  21.  
  22. $args = array(
  23. 'cat' => $current_cat,
  24. // 'tag' => $current_tag,
  25. 'post_type' => 'book',
  26. 'posts_per_page' => 1
  27. );
  28.  
  29. $the_second_query = new WP_Query( $args );
  30. // The Loop
  31. while ( $the_second_query->have_posts() ) : $the_second_query->the_post();
  32. the_title();
  33. endwhile;
  34.  
  35. // Reset Post Data
  36. wp_reset_postdata();
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement