Categories
Package/plugin/module WordPress

Custom Post Limits v2.0

I’d lke to announce the official release of the updated Custom Post Limits plugin (v2.0) for WordPress.

Control the number of posts that appear on the front page, search results, and author, category, tag, and date archives, independent of each other, including specific archives.

This release features a reimplemented approach to post limiting, WP2.8+ compatibility, dropped support for pre-WP2.6, and fixes for a couple minor bugs.

The plugin’s official homepage is located at :
coffee2code.com/wp-plugins/custom-post-limits.

Comments welcome on this post for this version of the plugin. Comments will be closed once this release has been superseded by another.

Read more for a detailed ChangeLog of the release.

Detailed ChangeLog

These are the detailed changes, some of which may or may not make sense to you depending on your familiarity with the previous features and internals of the plugin.

  • Reimplemented how post limiting is achieved by hooking ‘pre_option_posts_per_page’ rather than filtering ‘post_limits’
  • Simplified custom_post_limits()
  • Changed permission check to access settings page
  • Used plugins_url() instead of hardcoded path
  • Dropped support for versions of WP older than 2.6
  • Noted compatibility with WP2.8
  • Began initial effort for localization
  • Fixed edge-case bug causing limiting to occur when not appropriate
  • Fixed bug with tag names not appearing

9 replies on “Custom Post Limits v2.0”

Thank you for this plugin, it’s a great one.

Wanted to let you know that I’m having trouble trying to set different limits for individual categories.

I have entered different values for the number of posts to display on different category pages. For example, I have a “Podcast” category (I’m using a custom category template just for this category as well) that I link to from my top-nav that I would like to have 5 posts display per page. However, I have four more categories I use for subject categorization that I wouldn’t mind if 100 posts show up per page (I am using one standard template for all of those.) Any ideas?

I like the idea for this plug-in but I can’t get it to work. It installs fine, but when I enter new values and press Save Changes nothing is saved – I’m back to a screen with all field empry (default).
Any suggestions? I’m on WP 2.8.4, have tried in both IE and Firefox.

The plugin doesn’t work 100%. I want to keep the default 10 posts per pages as set in the admin. But for one particular category I want to display only 4 posts per pages.

But the plugin only reacts if I change the number on category as whole, it doesn’t react when I add limit 4 to only one category.

Any idea why? Thanks…

James, Darice : Thanks for the bug reports. I’ve been able to verify it and know the issue. Working on a fix which I plan to release soon.

Carl : Is there anything unique about how your site is configured? Are you running WP in a subdirectory of your main site maybe? Yours is the first report of the kind for this plugin, so I’m just trying to find what may be different. Are you running a translated/localized version of WP?

Thanks for the plugin – it’s definitely helping me out. One thing I’ve noticed is occasional SQL errors like this:

[12-Sep-2009 08:53:38] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘1.84467440737E+19, 9223372036854775807’ at line 1 for query SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND wp_term_taxonomy.taxonomy = ‘category’ AND wp_term_taxonomy.term_id IN (‘7’) AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 1.84467440737E+19, 9223372036854775807 made by require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

The limit looks pretty strange. Not sure if this is due to the plugin, but the 1.84467440737E+19 constant is suspicious.

In the WordPress file query.php this code:

if ( !isset($q[‘nopaging’]) ) {
if ($q[‘posts_per_page’] == -1) {
$q[‘nopaging’] = true;

suggests that returning -1 when no limit is wanted avoids the whole limit clause. I tried it and it seems to work. Was there a problem with this that led you to return the large number 18446744073709551615 for the no-limit case?

Comments are closed.