Advertisement
Guest User

Set Max Posts with WP Pagination

a guest
May 10th, 2012
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. $temp = $wp_query;
  3. $wp_query= null;
  4. $wp_query = new WP_Query();
  5. $wp_query = new WP_Query( array(
  6. 'post_type' => 'posts',
  7. 'category' => 'your category'
  8. 'posts_per_page'=> 10,
  9. 'orderby'=> 'menu_order', //this comes in handy later!
  10. 'order'=> 'ASC',
  11. 'paged'=>$paged,
  12. ));?>
  13.  
  14. <?php while ($wp_query->have_posts()) : $wp_query->the_post();?>
  15. <div class="entry"> <!--or whatever div you want your posts to go in -->
  16. <?php $postNum = $post->menu_order + 1; if ($postNum < 31) : ?>
  17. <!--back to the post-->
  18. <?php else : wp_reset_query(); ?> <!--This is what stops the query after the 30th post!-->
  19. <?php ; endif; ?>
  20. </div>
  21. <?php endwhile;?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement