
內容簡介
使用 Nav Menu Field 外掛將導覽選單加入Advanced Custom Fields (ACF)。此外掛會在 ACF(版本 5 和 4)加入 Nav Menu 欄位類型,讓您從 WordPress 管理後台建立的選單中選擇並使用於網站前端顯示。
使用 ACF,您可以設定 Nav Menu 欄位,讓其回傳所選選單的:
ID 以進行輕量開發
物件以進行複雜程式開發
HTML (從wp_nav_menu產生)以快速顯示選單
我創建此外掛是因為我需要在網站上顯示一個次要選單,取決於當前所在的頁面是哪一個。大部份頁面都是某一個父頁面的子頁面,但是我有幾個自訂文章類型。由於有自訂文章類型,所以我不能只取當前頁面的最高父頁面,然後使用wp_list_pages。因此,我進行了一些研究,並決定擴展我最喜愛的外掛Advanced Custom Fields的功能。現在,當我創建新頁面或自訂文章時,我只需從下拉式選單中選擇選單即可!
歡迎在開發網站上試用此附加元件,在上方支援連結上發問,並請檢查此附加元件。透過留下評分和評論,您能幫助此外掛變得更好!
Advanced Custom Fields 相容性
此附加元件適用於:
版本 5
版本 4
外掛標籤
開發者團隊
② 後台搜尋「Advanced Custom Fields: Nav Menu Field」→ 直接安裝(推薦)
原文外掛簡介
Add Navigation Menus to Advanced Custom Fields (ACF) with the Nav Menu Field plugin! This plugin adds the Nav Menu Field type to ACF (version 5 & 4), allowing you to select from the menus you create in the WordPress Admin backend to use on your website’s frontend.
Using ACF, you can set the Nav Menu Field to return the selected menu’s:
ID for lightweight coding,
Object for more involved programming, or
HTML (generated from wp_nav_menu) for quickly displaying a menu.
I created this plugin because I needed to display a secondary menu that changed depending on what page you’re on. Most of those pages were children of the same page, but then I had to throw a couple of Custom Post Types in there too. Because of the Custom Post Types, I couldn’t just grab the top most parent for the current page and use wp_list_pages. So I did some research and decided to extend the functionality of my favourite plugin, Advanced Custom Fields. Now when I create a new Page or Custom Post, I just select the menu from a drop down menu!
Feel free to try this add-on on your dev site, ask questions on the support link above, and please review this add-on. By leaving a rating and review, you help this plugin become even better!
Advanced Custom Fields Compatibility
This add-on will work with:
version 5
version 4
