[WordPress] 外掛分享: Navception

首頁外掛目錄 › Navception
200+
安裝啟用
★★★★★
5/5 分(9 則評價)
4166 天前
最後更新
問題解決
WordPress 3.5+ v2.0.0 上架:2013-06-27

內容簡介

關於Navception

Navception:將預先建立的WordPress選單嵌入另一個WordPress選單的行為。

Navception為WordPress菜單添加了一個簡單的功能,但也為強大的可能性打開了大門。在您的WordPress菜單編輯器中新增了一個框,讓您將菜單添加至菜單中!這允許您製作一個菜單,並將其作為次級菜單添加到另一個菜單中、在另一個菜單中多次添加或在多個菜單中多次添加。什麼使其強大?如果您決定需要在子菜單中增加另一個鏈接,則只需將其在一個位置上更新即可!Navception是一個簡單的概念,但具有強大的結果!

讓我們看一些場景:

沒有Navception

如果您需要在整個網站中重複使用次級菜單:首先您必須在您想要的每個地方添加所有鏈接,然後如果需要更新次級菜單,您必須修改次級菜單存在的每個地方的鏈接。
如果菜單項目太多:您必須挑選需要移除哪些菜單項目以為新菜單項目腾出空间。

有了Navception

如果您需要在整個網站中重複使用次級菜單:首先,您可以將子菜單製作成獨立的WordPress菜單,然後嵌入需要它的位置,接著,如果需要更新子菜單,您只需要在獨立菜單中修改鏈接即可。
如果菜單項目太多:您可以將某些子菜單分裁成WordPress菜單,然後將這些新菜單嵌入到原始菜單中,以腾出更多菜單項目的空间。

Navception的創建過程

在為客戶的主菜單工作時,我開始思考Navception的創建過程。該菜單是一個典型的三級菜單,其中有兩個子菜單,每個菜單都重複出現了四次。這些子菜單添加起來非常麻煩,而且也很難維護。當我意識到我想要一個可以將子菜單製作一次並將其作為菜單項目包含在另一個菜單中的插件時,我很驚訝沒有這樣的插件存在。

在繼續為該客戶的主菜單工作時,Navception已變得必不可少。這個菜單變得非常龐大,我收到了以下警告:您接近服務器配置所強制要求的帖子變量限制。超過此限制可能會在保存時自動刪除菜單項目。 結果,在WordPress管理區域中的每個Nav菜單項目大約有8個輸入與之相關聯。其中一個子菜單包含7個菜單項目,即56個輸入。使用Navception,我創建了一個子菜單,將其製作成獨立的WordPress菜單,然後包含它作為客戶主菜單的一個菜單項目。這使該子菜單產生的輸入從56個減少到8個,進而避免Post变量限制,並使菜单更易于管理。

Navception的危險性

當在其他菜單中嵌入菜單時,必須注意不要在自身中包含相同的菜單。當直接或間接完成時,這會導致您的網站進入無限循環中(也稱為Limbo),試圖顯示菜單。我新增了一些保護措施,以防止您意外引起這種情況,但我只有90%的信心說涵蓋了所有情況。如果您曾經使您的網站陷入Limbo,您只需要刪除您嵌入的菜單,然後在支持論壇中發帖告訴我您做的事情,以便我也可覆蓋該情況。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.0) 或搜尋安裝

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

原文外掛簡介

About Navception
Navception: The act of embedding a pre-constructed WordPress Menu inside another WordPress Menu.
Navception adds a simple feature to WordPress Menus, but opens the door to powerful possibilities. New to your WordPress Nav Menu editor, is a box that lets you add menus into your menus! This allows you to create one menu to include as a submenu once in another menu, multiple times in another menu, or multiple times in multiple menus. What makes this so powerful is that if you decide that your submenu needs another link added to it, you only have to update it in one place! Navception, a simple concept with powerful results!
Let’s look at a couple of scenarios:
Without Navception

If you have a submenu you need repeated across your site: First you have to add all the links everywhere you want the submenu, then to update the submenu you have to modify the links everywhere the submenu exists.
If you have too many menu items in your menu: You have to pick and choose which menu items are removed to make room for new ones.

With Navception

If you have a submenu you need repeated across your site: First you create the submenu as a stand-alone WordPress menu and embed it where you need it once, then to update the submenu you only need to modify the links in the stand-alone menu.
If you have too many menu items in your menu: You make some of the submenus separate WordPress menus and embed those new menus into the original menu to make room for more menu items.

Navception’s Inception
Navception became a thought when working on a client’s main menu. This menu was a typical 3 level menu, with two submenus that were repeated 4 times each. Those submenus were a hassle to add and a pain to maintain. When I realized that I wanted a plugin that allowed me to create a submenu once and include it as a menu item in a separate menu, I was surprised to find that no such plugin existed.
Navception became a necessity when working on that same client’s main menu. This menu became so large that I received the following warning: “You are approaching the post variable limit imposed by your server configuration. Exceeding this limit may automatically delete menu items when you save.” It turns out that every Nav Menu Item in the WordPress Admin area has roughly 8 inputs associated with it. One of the aforementioned submenus contained 7 menu items, or 56 inputs. Using Navception, I created that submenu as a stand-alone WordPress menu, then included it as 1 menu item in the client’s main menu. This reduced the inputs generated by that submenu from 56 to 8. Since that submenu was included 4 times, I not only avoided the Post Variable Limit, but I also made the menu easier to manage.
Dangers of Navception
When embedding menus in other menus, you must take care not to include the same menu in itself. When done directly or indirectly, this can cause your website to go into an infinite loop (aka Limbo) when attempting to display the menu. I added some safeguards to keep you from accidentally causing this to happen, though I’m only 90% confident that I covered all scenarios. If you ever put your website into Limbo, you only need to remove the menu you embedded, then please make a post in the support forum telling me what you did so I can cover that case as well.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon