Title: Custom Posts Per Page
Author: Jeremy Felt
Published: <strong>2011 年 10 月 7 日</strong>
Last modified: 2014 年 12 月 11 日

---

搜索插件

![](https://ps.w.org/custom-posts-per-page/assets/banner-772x250.png?rev=480289)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/custom-posts-per-page_45a2d1.svg)

# Custom Posts Per Page

 作者：[Jeremy Felt](https://profiles.wordpress.org/jeremyfelt/)

[下载](https://downloads.wordpress.org/plugin/custom-posts-per-page.zip)

 * [详情](https://cn.wordpress.org/plugins/custom-posts-per-page/#description)
 * [评价](https://cn.wordpress.org/plugins/custom-posts-per-page/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/custom-posts-per-page/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/custom-posts-per-page/#developers)

 [支持](https://wordpress.org/support/plugin/custom-posts-per-page/)

## 描述

Custom Posts Per Page allows you to specify how many posts are displayed per page
depending on your current view. Once settings are changed, the _Blog pages show 
at most_ setting in the _Reading_ menu will be ignored.

Settings are available for:

 * Home (Index) Page
    - As long as view is set to blog posts, not static page.
 * Category Pages
 * Tag Pages
 * Author Pages
 * Archive Pages
 * Search Pages
 * Default Page (_Any page not covered above._)
 * Custom Post Type archive pages
    - All Custom Post Types are detected automatically.

Each of the above settings can have a different value for the first page displayed**
and** subsequent paged views.

Custom Posts Per Page makes it easy to manage exactly how your content is displayed
to your readers, especially when different views have different layouts, rather 
than relying on the single setting in the Reading menu or having to hard code options
in your custom theme.

## 屏幕截图

 * [[
 * An overview of the Custom Posts Per Page settings screen.

## 安装

 1. Upload ‘custom-posts-per-page-count.php’ to your plugin directory, usually ‘wp-
    content/plugins/’, or install automatically via your WordPress admin page.
 2. Active Custom Posts Per Page in your plugin menu.
 3. Configure using the Posts Per Page menu under Settings in your admin page. (_See
    Screenshot_)

That’s it! The current setting for _Blog pages show at most_ under _Reading_ will
be used to fill in the default values. You can take over from there.

## 常见问题

  What are you doing with found_posts?

 * An issue was appearing in plugins that assisted with pagination when the setting
   for posts per page was different from subsequent pages. To resolve this issue,
   we do some math and return an incorrect found_posts value when that scenario 
   occurs. This doesn’t affect any core WordPress functionality, but could confuse
   other plugins that are looking for a correct value. I wouldn’t worry about this
   much, but keep it in mind if you are seeing issues _and_ have two different values
   entered as described.

  Should I keep using WordPress 3.2.1?

 * No. The next release of this plugin, version 1.8, will _not_ support WordPress
   3.2.1.

## 评价

![](https://secure.gravatar.com/avatar/9ff8fba293d4380ce1b8250b308c4b87f452c72a11fbac5d375bcf802cc90563?
s=60&d=retro&r=g)

### 󠀁[Still works great, even for 4.7.2](https://wordpress.org/support/topic/still-works-great-even-for-4-7-2/)󠁿

 [MediaBarker](https://profiles.wordpress.org/mediabarker/) 2017 年 1 月 28 日

Despite this being “out-of-date” this plug-in solved a problem for me. And there
have been no bad side effects. Thanks

![](https://secure.gravatar.com/avatar/10d328035e755cdf1f5e013982626ea2d5af04ca5e19fb8a371d7c90ad31a136?
s=60&d=retro&r=g)

### 󠀁[Awesome](https://wordpress.org/support/topic/awesome-3844/)󠁿

 [cyb3rnux](https://profiles.wordpress.org/cyb3rnux/) 2016 年 12 月 10 日

It’s awesome and it works! can’t style css on it but i hope i’ll fix it someday..
xD

![](https://secure.gravatar.com/avatar/76608d69915353f11913a82565deb771520c7857362c91ca3a399f9b4e4c76e4?
s=60&d=retro&r=g)

### 󠀁[Saved a lot of time and is a great addition](https://wordpress.org/support/topic/saved-a-lot-of-time-and-is-a-great-addition/)󠁿

 [Christina](https://profiles.wordpress.org/carasmo/) 2016 年 9 月 3 日

Thank you so much for making this plugin!

![](https://secure.gravatar.com/avatar/fd0a25a6cd1356c31e9ac1101f4e89ca988f1829a3223a1979f7c05f79aa7b10?
s=60&d=retro&r=g)

### 󠀁[Thanks](https://wordpress.org/support/topic/thanks-827/)󠁿

 [MartyCashew](https://profiles.wordpress.org/martycashew/) 2016 年 9 月 3 日

Helped me a lot

 [ 阅读所有12条评价 ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/)

## 贡献者及开发者

「Custom Posts Per Page」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Jeremy Felt ](https://profiles.wordpress.org/jeremyfelt/)

[帮助将「Custom Posts Per Page」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/custom-posts-per-page)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/custom-posts-per-page/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/custom-posts-per-page/)，或通过[RSS](https://plugins.trac.wordpress.org/log/custom-posts-per-page/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/custom-posts-per-page/)。

## 更新日志

#### 1.7.1

 * Switch to semantic versioning. 🙂
 * Code cleanup, compatibility testing with 4.1.
 * Add some extra sanitization, escaping.
 * Remove backwards compatible `is_main_query()` check. Use WordPress 4.0 or greater.

#### 1.7

 * Update documentation, compatibility testing with 3.5.

#### 1.6

 * General code cleanup, more documentation
 * Move final_options into a private property for easy passing around the plugin
 * Much improved logic for handling the expected page count based on found posts.
   Should resolve any issues found when using plugins such as WP-PageNavi to show
   number of pages in navigation.

#### 1.5

 * A bunch of code cleanup. Move everything to a class.
 * Cleanup text domain stuff in preparation for a new translation (sweet!)
 * Document more, handle default settings a bit better.

#### 1.4

 * **New** – Proper handling with is_main_query. Will no longer affect queries for
   side bars and such.
 * General code cleanup, IDE was using ugly spaces
 * Reworked some DB options to fit the schema for the rest. Easier to handle in 
   code now.

#### 1.3.3

 * Beginnings of new fix to handle paged offsets. Paging works as expected now.
 * Sorry for all the updates. Screwed that one up for a minute. 🙂

#### 1.3.2

 * Quick immediate fix of offset issues on paged views. Exploring deeper fix.

#### 1.3.1

 * Fix mishandling of adding new options during upgrade.

#### 1.3

 * **New** – Added options to control first page vs subsequent pages for all views.
 * Cleaned up handling of option initialization upon activation.
 * Cleaned up handling of option validation

#### 1.2.2

 * Undefined index headers may have been output on some servers, causing a small
   error in WordPress upon activation. Resolved.

#### 1.2.1

 * Confirmed and noted support for 3.3

#### 1.2

 * Added I18n support, now accepting translations!
 * Added an uninstall.php file to handle option cleanup in the database if the plugin
   is ever deleted. Please don’t delete me. 🙂
 * Added a ‘Settings’ link under the plugin once activated to make it easier to 
   configure right away.
 * Made some changes to the readme file better describing the current state of things.

#### 1.1

 * Added an option for Front Page Posts Count so that the front page could be treated
   differently than pages 2,3,etc..
 * Corrected issue that may have made it possible to lose settings on deactivation/
   activation or update.

#### 1.0

 * **Custom Post Types** – Custom post types are automatically detected and can 
   be configured through settings.
 * Now pulls current _Blog pages show at most_ value for use on plugin activation
   instead of defaulting to 10.
 * Allows for value of 0 to be set on any option in order for that view to be controlled
   somewhere else.

#### 0.2

 * Directory structure sent to SVN stopped plugin from working. Resolved.

#### 0.1

 * In which a plugin begins its life.

## 额外信息

 *  版本 **1.7.1**
 *  最后更新：**11 年前**
 *  活跃安装数量 **900+**
 *  WordPress 版本 ** 4.0 或更高版本 **
 *  已测试的最高版本为 **4.1.42**
 *  语言
 * [English (US)](https://wordpress.org/plugins/custom-posts-per-page/)
 * 标签
 * [admin](https://cn.wordpress.org/plugins/tags/admin/)[administration](https://cn.wordpress.org/plugins/tags/administration/)
   [archives](https://cn.wordpress.org/plugins/tags/archives/)[posts per page](https://cn.wordpress.org/plugins/tags/posts-per-page/)
   [settings](https://cn.wordpress.org/plugins/tags/settings/)
 *  [高级视图](https://cn.wordpress.org/plugins/custom-posts-per-page/advanced/)

## 评级

 4.8 星（最高 5 星）。

 *  [  11 条 5 星评价     ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/?filter=4)
 *  [  1 条 3 星评价     ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/custom-posts-per-page/reviews/)

## 贡献者

 *   [ Jeremy Felt ](https://profiles.wordpress.org/jeremyfelt/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/custom-posts-per-page/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://jeremyfelt.com/wordpress/plugins/custom-posts-per-page/)