Title: [Plugin: Display Posts Shortcode] pagination
Last modified: August 20, 2016

---

# [Plugin: Display Posts Shortcode] pagination

 *  Resolved [mrhayduke](https://wordpress.org/support/users/mrhayduke/)
 * (@mrhayduke)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/)
 * Hello. I’ve used this plugin on a site in development and works great and well
   documented. Thank you.
 * Wondering if you have any thoughts about if/how one could use pagination when
   there are a lot of results. I know we can use posts_per_page=-1 to list all posts
   but if there are a lot (20, 30, 40, etc.) it gets to be an unwieldy page.
 * Thanks.
 * Ted
 * [http://wordpress.org/extend/plugins/display-posts-shortcode/](http://wordpress.org/extend/plugins/display-posts-shortcode/)

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Bill Erickson](https://wordpress.org/support/users/billerickson/)
 * (@billerickson)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423620)
 * The problem with pagination is that it would interfere with the query of the 
   current page. If you have a multi-page article and you use the display posts 
   shortcode with pagination, clicking “Next” will show the next results AND change
   the page content.
 * If you need pagination, it’s really best to [customize the main WordPress query.](http://www.billerickson.net/customize-the-wordpress-query/)
 *  Thread Starter [mrhayduke](https://wordpress.org/support/users/mrhayduke/)
 * (@mrhayduke)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423621)
 * Thanks, Bill. I realize pagination isn’t something the plugin (which is great,
   btw) is intended to tackle. Appreciate the reply!
 *  [kjparish](https://wordpress.org/support/users/kjparish/)
 * (@kjparish)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423631)
 * I’ve gotten this plugin to work with pagination using WP-Page Navi, but you need
   to feel comfortable tweaking the plugin itself. I installed WP Page Navi and 
   dropped in much of the code from this blog post: [ and it works!](http://wordpress.org/support/topic/wp-pagenavi-with-custom-query-and-paged-variable?replies=2)
 *  [wpforchurch](https://wordpress.org/support/users/wpforchurch/)
 * (@wpforchurch)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423653)
 * Would you be so kind as to post what changes you made to the plugin? Did you 
   add code from WP Page Navi or just install the plugin?
 * Thanks!
 *  [designblogg](https://wordpress.org/support/users/designblogg/)
 * (@designblogg)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423654)
 * Yea would like to know how you did it aswell
 *  [kjparish](https://wordpress.org/support/users/kjparish/)
 * (@kjparish)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423655)
 * So, it’s been a little while now since I set this up, but here’s what I did (
   which worked):
 * You need to open the display-posts-shortcode.php file in the plugin folder. Find
   the // Set up initial query for post // section. This is where you’ll be adding
   to the existing code and inserting the query that allows for pagination (this
   is a copy of what I created before the “// If Post IDs” section).
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * Next – you need to add pagenavi. I inserted it after the ‘endwhile;’ like so:
 *     ```
       endwhile;
       wp_pagenavi( array( 'query' => $listing ) );
          wp_reset_query();
       ```
   
 * I’m no expert at this stuff, but I was able to hack a bit to get this working.
   I hope this helps you.
 *  [Leiif](https://wordpress.org/support/users/leiif/)
 * (@leiif)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423688)
 * Where’s the code? I see the part about pagenavi.
 *  [Leiif](https://wordpress.org/support/users/leiif/)
 * (@leiif)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423689)
 * My question has been resolved. I found a work around with the Advanced Excerpts
   plugin.
 *  [Bernie](https://wordpress.org/support/users/fruitshakes/)
 * (@fruitshakes)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423692)
 * Haven’t seen any resolutions? How come it was resolved?
    Any workaround yet? 
   Thanks.
 *  [kjparish](https://wordpress.org/support/users/kjparish/)
 * (@kjparish)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423693)
 * Did not realize my code snippet above had been chopped off some time ago. Here
   it is again. Hope this helps.
 *     ```
       // Set up initial query for post
       	$args = array(
       		'post_type' => $post_type,
       		'tag' => $tag,
       		'category_name' => $category,
       		'posts_per_page' => $posts_per_page,
       		'order' => $order,
       		'orderby' => $orderby,
   
       	);
   
       if( get_query_var( 'paged' ) )
       	$my_page = get_query_var( 'paged' );
       else {
       	if( get_query_var( 'page' ) )
       		$my_page = get_query_var( 'page' );
       	else
       		$my_page = 1;
       	set_query_var( 'paged', $my_page );
       	$paged = $my_page;
       }
   
       // default loop here, if applicable, followed by wp_reset_query();
   
       $args = array(
       	// other query params here,
       	'paged' => $my_page
       );
       ```
   
 *  [Leiif](https://wordpress.org/support/users/leiif/)
 * (@leiif)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423694)
 * In regard to “fruitshakes” and my post.
    “My question has been resolved. I found
   a work around with the Advanced Excerpts plugin.”
 * I am not using this plugin as I found a better solution with “Advanced Excerpts”
 *  [Bernie](https://wordpress.org/support/users/fruitshakes/)
 * (@fruitshakes)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423695)
 * Leiif,
 * Will celebrate if you share your workaround on Advanced Exerpts for pagination.
 *  [tennyy](https://wordpress.org/support/users/tennyy/)
 * (@tennyy)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423713)
 * kjparish,
 * When I try this, it will show all categories in my list even I only set one category,
   how can I fix it?
 * meanwhile, can I move the pagination to the bottom?
 * Thanks!
 *  [Leiif](https://wordpress.org/support/users/leiif/)
 * (@leiif)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423714)
 * Hi fruitshakes,
 * Sorry I didn’t get notice of your post but just got one for the last post by 
   tennyy. I wanted my category pages to show more than just the basic excerpt and
   using “Advanced Excerpts” was what worked for me. I use my categories as navigational
   aids to getting to specific types of posts. Not sure what you are after.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘[Plugin: Display Posts Shortcode] pagination’ is closed to new replies.

 * ![](https://ps.w.org/display-posts-shortcode/assets/icon-256x256.jpg?rev=2940963)
 * [Display Posts - Easy lists, grids, navigation, and more](https://wordpress.org/plugins/display-posts-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/display-posts-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/display-posts-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-posts-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-posts-shortcode/reviews/)

 * 14 replies
 * 8 participants
 * Last reply from: [Leiif](https://wordpress.org/support/users/leiif/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-display-posts-shortcode-pagination/#post-2423714)
 * Status: resolved