前言介紹
- 這款 WordPress 外掛「Sectors – Conditional Templates & Hooks」是 2018-02-04 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2024-07-28,距離現在已有 280 天。
- 外掛最低要求 WordPress 4.8 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
hooks | actions | filters | conditional templates |
內容簡介
Sectors 是 WordPress 中獨一無二的外掛,可建立任何內容上下文的主題樣板。確保僅在滿足某些條件時添加選定的動作或過濾器。
上下文
當您在網站中添加新的區塊時,會選擇其所涵蓋的內容。這可能是:
選定類別中的所有文章
特定作者的頁面
具有自訂分類的自訂文章類型
…
以上任意組合
Sectors 還內建支援 BuddyPress、WPML、Polylang 等功能。
樣板
Sectors 會在您的佈景主題資料夾中尋找以下樣板:
/sectors/
/sector-
如果找到,它將自動載入給予上下文的樣板。
API
樣板標籤
檢查查詢是否是給定或任何區塊的一部分:
is_sector(string $sector):boolean
取得當前上下文的所有區塊:
get_current_sectors():array
鉤子
Sectors 透過添加範圍擴展所有 WordPress 動作和過濾器。這意味著您可以向動作添加回呼並確保它僅在特定上下文中執行:
add_sector_action(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )
add_sector_filter(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )
原文外掛簡介
Sectors is a first of its kind plugin for WordPress. Create theme templates for any context on your site. Make sure select Actions or Filters are only added when certain conditions are met.
Contexts
When you add a new sector to your site, you select the content it covers. This could be:
All posts in a select category
Pages by an author
Custom Post Types with a Custom Taxonomy
…
Any combination of above
Sectors also comes with built in support for BuddyPress, WPML, Polylang, and more.
Templates
Sectors will look in your theme folder for the following templates:
/sectors/
/sector-
If found, it will be automatically loaded for the context.
API
Template Tags
Check if a query is part of a given or any sector:
is_sector(string $sector):boolean
Get all sectors for current context:
get_current_sectors():array
Hooks
Sectors extends all WordPress Actions and Filters by adding a scope. This means you can add a callback to an action and make sure it’s only executed in a given context:
add_sector_action(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )
add_sector_filter(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Sectors – Conditional Templates & Hooks」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Genesis Simple Hooks 》此外掛程式會建立一個新的 Genesis 設定頁面,讓你可以插入程式碼 (HTML、簡碼和 PHP),並依附於 Genesis 主題框架中的 50 多個動作鉤子中的任何一個。, 不必...。
WooCommerce HookMeUp 》HookMeUp 是一個 WordPress 外掛,可協助非開發人員在任何 WooCommerce 主題的關鍵區域插入額外內容、橫幅和短碼,而不需要更改主題的程式碼。探索和使用頁面...。
Homepage Control 》使用 Homepage Control 外掛,任何採用「homepage」或其他钩子(hook)在首頁上顯示組件的佈景主題,可以更好地進行配置。重新排序或禁用佈景主題新增的任何首...。
Genesis Simple Sidebars 》這個外掛允許你建立多個動態小工具區域,並按照每個文章、頁面或標籤/類別存檔設定將這些小工具區域指派給 Genesis 框架內的側邊欄位置。, , 對於初學者來說...。
Debug This 》Debug This是由友好Macho Themes團隊打造、維護和運營的獨立外掛程式。, 對於管理員、開發人員和支援人員,Debug This提供了大量的有關WordPress安裝的信息,...。
Vercel Deploy Hooks 》這是一個 WordPress 外掛,當您發布新的 WordPress 文章、更新 WordPress 文章或從 WordPress 管理員選單或管理員工具列啟動部署時,可將靜態網站部署到 Verc...。
Genesis Visual Hook Guide 》從一個工具漸漸地演進為現在的Genesis視覺鈎子指南,現在迎來了這個外掛版的熱門Visual Genesis Hooks和Filters指南來自Genesis Tutorials。, 安裝此外掛後,...。
Visual Hook Guide for Kadence 》這個外掛是供開發人員與 Kadence 佈景主題一起使用,並在前端 WP 管理列中新增了一個 Kadence Hooks 選項。, 點擊子選單中的 Action Hooks 將會顯示該頁面上...。
WP Hooks 》WP Hooks 是 WordPress 的外掛,它讓您可以在不修改主題的情況下,將 JavaScript、HTML 或其他程式碼加入, 標頭 (header) 和頁尾 (footer)。WP Hooks 使用 Wo...。
Simple Hooks for WooCommerce 》若要使用 WooCommerce 的 hooks,您需要將自訂代碼加入至主題的 functions.php 檔案中。, 這個外掛能夠讓您更輕鬆地新增 WooCommerce 的 hooks,因此即使您不...。
Hybrid Hook Widgets 》Hybrid Hook Widgets 是一個外掛,它為 Hybrid 佈景主題 創建新的小工具區域並將它們附加到佈景主題的行動鉤子上。基本上,它允許您在幾乎任何地方添加小工具...。
GPP Base Hook Widgets 》GPP Base Hook Widgets 是一個 WordPress 外掛,它會為 Graph Paper Press 的 Base 佈景主題建立新的小工具區域並將它們附加到主題所提供的 action hook 上。...。
GPP About You Widget 》GPP About You Widget 是一個 WordPress 外掛,可將小工具加入到您主題中任何小工具區域中,輕鬆創建關於您的資訊。, 此外掛僅支援 WordPress 3.0+。。
Genesis Post Teasers 》此外掛使用 Genesis Grid Loop 函數在首頁、檔案庫或部落格模板上顯示文章摘要,並提供額外的選項以控制它們。輕鬆地在頂端顯示 1,2,3...許多特色文章和下面...。
GPP Testimonials Widgets 》在小工具面板中新增一個「推薦信」小工具。。