This is an information and discussion page for the WordPress plugin, Custom Posts Per Page. Feel free to leave comments and suggestions about the plugin below or download Custom Posts Per Page through the WordPress plugin repository. You can also fork and/or contribute to Custom Posts Per Page on GitHub.
Custom Posts Per Page is a plugin that allows you to specify how many posts are displayed by WordPress in a certain view. You may have noticed that only one option for posts_per_page is available under the WordPress Reading menu. Once you start to add on custom post types and various ways of handling your archives, a one size fits all option starts to be unfortunate.
I hunted around quite a while and could not find any plugins that allowed for advanced control of this option and wasn’t able to find anything that did this without also adding other extra features. Because nothing appeared to solve the problem at hand for me, I wrote this plugin and made it available for you.
What Can It Do?
The default Posts Per Page setting can now be set specifically for these page types:
- Main Index (Overrides default setting)
- Category Pages
- Tag Pages
- Author Pages
- Archive Pages
- Search Pages
- Default (All other types)
- Any registered Custom Post Types
In addition, each of these comes with a second option for how many posts show up on subsequent pages. You may only want two posts to appear on your home page, but once somebody is engaged in your site and clicks on older posts, you may want to show them 5 posts on each of those. That’s where Custom Posts Per Page comes in the most handy.
Version 1.7 Notes:
This is mostly a maintenance version. A few things about version 1.6 are better documented behind the scenes and in the readme file and compatibility for WordPress 3.5 is verified. Fair warning, version 1.8 will not support anything earlier than WordPress 3.3, so please upgrade.
Version 1.6 Notes:
This version accomplishes a few things. First, as the release of WordPress 3.5 is around the corner, we confirm compatibility with the latest release. A bunch of the code was refactored and cleaned up for my sanity. Last, but not least, we play with found_posts a bit to allow plugins like WP-PageNavi to report the correct number of pages when a different posts per page value is set for the first and following pages. I have my ear to the ground as to whether this broke anything else in the world, but things seem to be going ok for the moment.
Version 1.4 Notes:
In previous version, there was an issue because of my failure to check is_main_query. Because of this, queries for sidebars and other custom theme queries may have been changed unwillingly. This has been resolved and only the main query for each page will be changed. Sweet!
Also, I took away the official support for 3.1. I don’t really see any use to supporting a version from that far back.
Version 1.3 Notes:
Support for paged views is now working wonderfully. A custom count can be set for page one and a separate one for all subsequent views. This one is awesome IMO.
Version 1.0 Notes:
Support for custom post types has been added!
Original 0.1 Release:
My hope is to soon add support for custom post types and custom taxonomies. The current version is 0.1 and has been tested primarily with WordPress 3.2.1. There is nothing in the code that should not work as long as you have WordPress version 3.1 or greater installed. I will be testing with multiple versions shortly and this note may go away.