Independently control the number of posts listed on the front page, author/category/custom post type/custom taxonomy/tag archives, search results, etc …
Control the number of posts that appear on the front page, search results, and author, category, tag, custom post type, custom taxonomy, and date archives, independent of each other, including specific archives.
By default, WordPress provides a single configuration setting to control how many posts should be listed in each section of your blog. This value applies for the front page listing, author listings, archive listings, category listings, tag listings, custom post type listings, custom taxonomy listings, and search results. This plugin allows you to override that value for each of those different sections.
Specifically, this plugin allows you to define limits for:
If the limit field is empty or 0 for a particular section type, then the default post limit will apply. If the value is set to -1, then there will be NO limit for that section (meaning ALL posts will be shown). The Archives Limit value is also treated as the default limit for Day, Month, and Year archives, unless those are explicitly defined.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
The plugin exposes a number of filters for hooking. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).
c2c_cpl_enable_all_individual_limits (filter)
The ‘c2c_cpl_enable_all_individual_limits’ hook allows you to filter if individual limits are enabled for all archive types.
The ability to set individual limits (e.g. for per-author or per-category archives) isn’t simply enabled by default because it can have a negative performance impact depending on the number of items. Especially for a something most sites are unlikely to need.
Arguments:
Example:
// Enable individual limits for all archives for Custom Post Limits plugin. add_filter( 'c2c_cpl_enable_all_individual_limits', '__return_true' );
c2c_cpl_enable_all_individual_{$type}_limits (filter)
The ‘c2c_cpl_enable_all_individual_{$type}_limits’ hook allows you to filter if individual limits are enabled for a specific archive type. The dynamic portion of the hook name, $type
, refers to the type of archive with constituent individual archives. Can be ‘authors’, ‘categories’, or ‘tags’.
Arguments:
Example:
// Enable individual limits for author archives for Custom Post Limits plugin. add_filter( 'c2c_cpl_enable_all_individual_authors_limits', '__return_true' );
custom-post-limits.zip
inside the plugins directory for your site (typically /wp-content/plugins/
).Settings
link next to its Deactivate
link (still on the Plugins page), or click on the Settings
-> Post Limits
link, to go to the plugin’s admin settings page. Optionally customize the limits.A screenshot of the plugin's admin settings page (with individual categories limits expanded) (top half of page). (Note: Screenshot hasn't been updated to include fields for defining limits for custom taxonomies.)
A screenshot of the plugin's admin settings page (with individual categories limits expanded) (bottom half of page). (Note: Screenshot hasn't been updated to include fields for defining limits for custom taxonomies.)
No. The plugin filters the posts_per_page setting value (and, when necessary, the LIMIT SQL clause) as used by the primary WordPress post query as appropriate, resulting in retrieval of only the number of posts up to the limit you specified without significant alteration of the primary query itself and without additional queries. Bottom line: this should perform efficiently.
Yes.
Highlights:
Details:
c2c_{PluginName}_Plugin_051
to c2c_Plugin_060
get_c2c_string()
as a getter for translated stringsget_c2c_string()
whitelist_options()
to allowed_options()
add_allowed_options()
instead of deprecated add_option_whitelist()
for WP 5.5+allowed_options
filter instead of deprecated whitelist_options
for WP 5.5+is_wp_version_cmp()
and get_c2c_string()
)is_wp_version_cmp()
as a utility to compare current WP version against a given WP versioncontextual_help()
to be easier to read, and correct function docblocksnumber_format_i18n()
to format integer value within input fieldreadme_url()
to refer to plugin’s readme.txt on plugins.svn.wordpress.orgHighlights:
Details:
get_authors()
, get_categories()
, and get_tags()
from calling potentially resource-intensive functions when individual limits aren’t enabledadjust_max_num_pages()
to potentially adjust main query object’s max_num_pages valuecustom_post_limits()
for forcing it to behave as if query was pagedprintf()
rather than using string concatenationget_author()
if they don’t have the ‘author’ roletype='text/javascript'
attribute from <script>
tagis_main_query()
instead of replicating what it doesget_authors()
, get_categories()
test_get_custom_taxonomy()
to avoid occasional failuretest_tags_paged_limit()
for versatility by accepting arguments and calculating assertion expectations based on those parametersreset_caches()
in tearDown()
Highlights:
This release fixes a number of minor bugs.
Details:
is_individual_limits_enabled()
staticallyget_authors()
, get_categories()
, and get_tags()
as arraysdisplay_individual_option()
get_tags()
plugins_loaded
Full changelog is available in CHANGELOG.md.