[WordPress] 外掛分享: Exclude Pages

首頁外掛目錄 › Exclude Pages
30,000+
安裝啟用
★★★★
4.9/5 分(47 則評價)
3032 天前
最後更新
問題解決
WordPress 2.2.3+ v1.92 上架:2007-09-21

內容簡介

這個外掛新增了一個勾選框,「在選單中包含此頁面」,取消勾選則排除使用者在您的網站上看到的頁面導覽中的頁面。

如有問題:聯繫我。此插件新增了一個勾選框「在選單中包含此頁面」,預設已勾選,取消勾選後,此頁面將不會出現在任何頁面列表中(包括且通常限定在您的頁面導覽選單)。

在排除的頁面的子頁面也不會顯示在選單列表中(在編輯畫面下,「包含」勾選框下方的提醒讓您跟踪哪個祖先頁面會影響子頁面的方式。)

進階使用

可以使用新的<?php pause_exclude_pages(); ?>和<?php resume_exclude_pages(); ?>樣板標籤,暫時中斷或恢復排除頁面的效果。下列代碼將顯示您網站中所有頁面的列表,即使那些通常被隱藏的頁面也會顯示:

<?php pause_exclude_pages(); ?>
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
<?php resume_exclude_pages(); ?>

您也可以通過調用函數ep_get_excluded_ids();來獲取被排除頁面的ID數組,然後按照您的需求使用這些ID(例如,將它們作為原始MySQL查詢的輸入)。

向其他外掛作者說明:

如果使用者在管理頁面上,則這個外掛不會作用於wp_list_pages,如果這是一個問題,您可以利用ep_admin_bail_out過濾器並創建過濾器函數,返回false以允許Exclude Pages在管理區域中運作。

另一個注意事項:

如果您的外掛或主題未使用標準的WordPress功能來創建其菜單,那它們將無法正常工作。要使它們正常工作,您需要找到在主題/外掛中獲取頁面的代碼段並更改為應用過濾器“get_pages”(我對您所做的更改造成的任何無法預見的後果概不負責,因此請仔細測試)獲取頁面的更改可能會類似於以下代碼:

$pages = apply_filters( 'get_pages', $pages );

如果您完全無法解決問題,請聯繫我,我們可以討論可能的解決方案。

排除頁面和以下不兼容:

WP CSS下拉菜單
Phantom主題 - 此主題

請求和錯誤報告

我僅在此註記請求和錯誤報告,我並沒有調查這些事項。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.92) 或搜尋安裝

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

原文外掛簡介

This plugin adds a checkbox, “include this page in menus”, uncheck this to exclude pages from the page navigation that users see on your site.
Any issues: contact me.This plugin adds a checkbox, “include this page in menus”, which is checked by default. If you uncheck
it, the page will not appear in any listings of pages (which includes, and is usually limited to, your
page navigation menus).
Pages which are children of excluded pages also do not show up in menu listings. (An alert in the editing screen,
underneath the “include” checkbox allows you to track down which ancestor page is affecting child pages
in this way.)
Advanced Usage
It is possible to temporarily pause and resume the effect of Exclude Pages by using the new and templates tags. The following code will show a list of all pages in your site, even those normally hidden:

Pages

' ); ?>

You can also get an array the IDs of the pages which are excluded by calling the function ep_get_excluded_ids();, you can then use these IDs as you wish (e.g. feed them into raw MySQL queries).
Note to other plugin authors:
The plugin does not operate on wp_list_pages while the user is on an admin page, if this is an issue you can take advantage of the ep_admin_bail_out filter and create a filter function which returns false to allow Exclude Pages to operate in the admin area.
Another note:
If your plugins or themes don’t use the standard WordPress functions to create their menus then they won’t work. To get them to work you will need to track down the bit of code in the theme/plugin which gets the pages and change it to apply the filter “get_pages” (I cannot be responsible for any unforseen effects of the changes you make, so please test thoroughly). The change to getting pages will probably look something like this:
$pages = apply_filters( 'get_pages', $pages );

Please contact me if you’re completely stuck and we can discuss possible solutions.
Exclude pages is incompatible with:

WP CSS Dropdown Menus
Phantom theme – This theme

Requests & Bug Reports
I’m simply noting requests & bug reports here, I’ve not necessarily looked into any of these.
None!

文章
Filter
Apply Filters
Mastodon