Advertisement
salmancreation

Custom post type page template pagination

Jul 2nd, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. Custom post type page template pagination
  2. ============================================================
  3. <!-- copy and past in Pate Template -->
  4.  
  5. <?php
  6. global $wp_query;
  7.  
  8. $wp_query = new WP_Query( array ( 'post_type' => 'items', 'posts_per_page' => '3', 'paged' => get_query_var( 'paged' ) ) );
  9. if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  10.  
  11. <!-- post code here........ -->
  12.  
  13. <?php endwhile;
  14. endif; ?>
  15.  
  16.  
  17. <!-- for show -->
  18. ----------------------------------
  19. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts') ); ?></div>
  20. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>') ); ?></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement