
內容簡介
這個外掛會連結到 WordPress 核心功能的 wp_list_pages 函數,從產生的清單中移除不在當前導覽路徑中的頁面。這會創造出一個手風琴式的導覽效果,是一種替代CSS方案的方式,該方案建議請參閱官方說明文件。
通過在伺服器端移除不需要的HTML元素,可以減小頁面大小,並且客戶端渲染通常會更快。尤其是對於舊的瀏覽器和具有大量已發佈頁面的網站,效果更加顯著。
此外掛旨在與 WordPress 自帶的「頁面」小工具或任何使用wp_list_pages的導覽元件一起使用。
此外掛有兩種應用過濾器的方式:
修改 WordPress 自帶的頁面小工具
在使用 wp_list_pages 的任何地方應用過濾器
請注意,由於第二個選項使用 wp_list_pages 過濾器,所以過濾將應用於使用了 wp_list_pages 的任何地方,包括未分配自定義選單的菜單位置。請確保所有的菜單位置都有一個自定義選單指定,以避免意外行為的產生。
這個外掛需要 PHP DOMDocument 擴展和 PHP5 版本。
外掛標籤
開發者團隊
原文外掛簡介
Hooks into WordPress core function wp_list_pages, and removes pages from the generated list that are not part of the
current navigation path. This creates an accordion navigation effect, and is an alternative approach to the CSS-based
way suggested in the Codex.
By removing unneeded HTML elements server-side, page size is reduced, and client-side rendering will usually be faster.
This is especially true for older browsers, and sites with a large number of published pages.
This plugin is intended to be used with the “pages” widget that comes with WordPress, or any navigation element that uses
wp_list_pages.
There are two ways the plugin can apply the filter.
By modifying the default Pages widget that comes with WordPress
By applying the filter everywhere wp_list_pages is used
Please note that since the second option uses the wp_list_pages hook, the filtering will take place anywhere
wp_list_pages is used. This includes menu locations to which no custom menu is assigned. Please make sure all your
menu locations have a custom menu assigned to them to avoid unexpected behavior.
This plugin requires the PHP DOMDocument extension, and PHP5.
