[WordPress] 外掛分享: Custom Post Limits

首頁外掛目錄 › Custom Post Limits
WordPress 外掛 Custom Post Limits 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
2,000+
安裝啟用
★★★★
4.3/5 分(6 則評價)
1798 天前
最後更新
問題解決
WordPress 4.9+ v4.4.1 上架:2009-07-15

內容簡介

此外掛可獨立控制首頁、搜尋結果、作者、分類、標籤、自訂文章型別、自訂分類法和日期存檔的文章數量,包括特定的存檔。 WordPress 預設提供一個設定選項來控制部落格中各個區段的文章數量。 這個數值適用於首頁、作者列表、存檔列表、分類列表、標籤列表、自訂文章類型列表、自訂分類法列表和搜尋結果。 此外掛可讓您覆蓋每個部分的值。 此外掛可讓您針對以下部分定義限制:

• 作者存檔(任何作者的文章存檔)
• 作者存檔非第一頁(當瀏覽作者存檔清單時,不在第一頁時列出的文章數)
• 作者存檔(任何特定作者的文章存檔)
• 分類存檔(任何類別的文章存檔)
• 分類存檔非第一頁(當瀏覽分類存檔清單時,不在第一頁時列出的文章數)
• 特定自訂文章類型存檔(任何特定自訂文章類型的存檔列表)
• 自訂分類法存檔(任何特定自訂分類法的存檔列表)
• 日存檔(任何日的文章存檔)
• 日存檔非第一頁(當瀏覽日存檔清單時,不在第一頁時列出的文章數)
• 首頁(博客首頁上的文章列表)
• 首頁非第一頁(當瀏覽首頁清單時,不在第一頁時列出的文章數)
• 月存檔(任何月份的文章存檔)
• 月存檔非第一頁(當瀏覽月存檔清單時,不在第一頁時列出的文章數)
• 搜尋結果(搜尋結果列表)
• 搜尋結果非第一頁(當瀏覽搜尋結果列表時,不在第一頁時列出的文章數)
• 標籤存檔(任何標籤的文章存檔)
• 標籤存檔非第一頁(當瀏覽標籤存檔清單時,不在第一頁時列出的文章數)
• 獨立的標籤存檔(任何特定標籤的文章存檔)
• 年存檔(任何年份的文章存檔)
• 年存檔非第一頁(當瀏覽年存檔清單時,不在第一頁時列出的文章數)

如果某個部分的限制欄位為空或 0,則將套用預設文章限制。 如果值設為-1,則該部分將沒有限制(表示會顯示全部文章)。 存檔限制值也會被視為 day、month 和 year 存檔的預設限制,除非這些存檔是明確定義的。

連結: 外掛主頁 | WordPress 外掛頁面 | GitHub | 作者主頁

Hooks
此外掛公開了許多過濾器以進行掛鈎。 通常,使用過濾器的程式碼最好放在「mu-plugin」或「特定網站外掛」 中(這超出此自述文件的範圍)。

外掛標籤

開發者團隊

⬇ 下載最新版 (v4.4.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Custom Post Limits」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

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:

Authors archives (the archive listing of posts for any author)
Authors archives non-first-page (when paging through authors archives listings, number of posts listed when not on the first page)
Author archives (the archive listing of posts for any specific author)
Categories archives (the archive listings of posts for any category)
Categories archives non-first-page (when paging through categories archives listings, number of posts listed when not on the first page)
Category archive (the archive listings of posts for any specific category)
Custom post type archives (the archive listings of posts for any specific custom post type)
Custom taxonomy (the archive listings of posts for any specific custom taxonomy)
Day archives (the archive listings of posts for any day)
Day archives non-first-page (when paging through day archives listings, number of posts listed when not on the first page)
Front page (the listing of posts on the front page of the blog)
Front page non-first-page (when paging through front page listings, number of posts listed when not on the first page)
Month archives (the archive listings of posts for any month)
Month archives non-first-page (when paging through month archives listings, number of posts listed when not on the first page)
Search results (the listing of search results)
Search results non-first-page (when paging through search results listings, number of posts listed when not on the first page)
Tags archives (the archive listings of posts for any tag)
Tags archives non-first-page (when paging through tags archives listings, number of posts listed when not on the first page)
Tag archive (the archive listings of posts for any specific tag)
Year archives (the archive listings of posts for any year)
Year archives non-first-page (when paging through year archives listings, number of posts listed when not on the first page)

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
Hooks
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:

$enabled (boolean): Enable individual limits for all archive types? Default false.

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:

$enabled (boolean): Enable individual limits for given archive type? Default false.

Example:
// Enable individual limits for author archives for Custom Post Limits plugin.
add_filter( 'c2c_cpl_enable_all_individual_authors_limits', '__return_true' );

延伸相關外掛

文章
Filter
Mastodon