rodro1

pagination with custom post type

Feb 4th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.   $temp = $wp_query;
  3.   $wp_query = null;
  4.   $wp_query = new WP_Query();
  5.   $wp_query->query('showposts=6&post_type=news'.'&paged='.$paged);
  6.  
  7.   while ($wp_query->have_posts()) : $wp_query->the_post();
  8. ?>
  9.  
  10.   <!-- LOOP: Usual Post Template Stuff Here-->
  11.  
  12. <?php endwhile; ?>
  13.  
  14. <nav>
  15.     <?php previous_posts_link('&laquo; Newer') ?>
  16.     <?php next_posts_link('Older &raquo;') ?>
  17. </nav>
  18.  
  19. <?php
  20.   $wp_query = null;
  21.   $wp_query = $temp;  // Reset
  22. ?>
Add Comment
Please, Sign In to add comment