內容簡介
Foundation Top Bar Navigation Menu 外掛允許主題開發人員將 WordPress 選單顯示為響應式的 Foundation 上方工具列。該外掛包含以下核心功能:
通过與選單或页面列表結構相匹配,應用 Foundation 上方工具列的類名
注册默认「上方工具列」的選單位置
支持包含支持上方工具列的基礎版 Foundation
請到Zurb Foundation網站查看更多有關 Foundation 上方工具列的資訊和示例。
使用方法
在主題中下載並包含 Foundation 框架(或者使用插件中包含的基礎版-請參閱下面的注意事項)。
將新選單或現有WordPress選單指派給「上方工具列」的選單位置(或使用‘wp_list_pages’將頁面列表顯示為上方工具列)-詳見下文。
編輯主題模板,將上方工具列選單顯示在所需位置。使用WordPress的‘wp_nav_menu’函數來顯示上方工具列:
<?php
if ( has_nav_menu('topbar') ) {
wp_nav_menu( array(
'theme_location' => 'topbar',
'container' => false,
'walker' => new ftb_menu()
));
}
?>
使用‘wp_list_pages’函數,可以顯示頁面列表而不是選單:
<?php
wp_list_pages( array(
'title_li' => '',
'walker' => new ftb_pages()
));
?>
注意事項
‘ftb_menu ()’ 和 ‘ftb_pages ()’ 这两个选择器都接受一个“no_wrap”参数。包含此參數可以去除預設的上方工具列 HTML 封套,只顯示<ul>無序列表。
‘wp_nav_menu() -> theme_location’ 參數可以設置為任何已註冊的選單區域。
該外掛選擇性地包含基礎版 Foundation 5.5.2,其中只包含了上方工具列。建議直接在主題中包含Foundation,而非使用此基礎版。要在主題中載入插件的基礎版,請在“設定 —> 常規”管理屏幕中將“在主題中載入基礎版Foundation”設置為“True”。
請到Zurb Foundation網站下載 Foundation,並查看安裝和使用說明文檔。
上方工具列的樣式是包含在 Foundation 框架中的默認樣式。透過 Foundation 和/或 WordPress 方法可以进行一定程度的自定义。但任何自定義必須由主題開發人員實現。
備註
使用Zurb Foundation版本5.5.2開發此插件。
外掛標籤
開發者團隊
② 後台搜尋「Foundation Top Bar Navigation Menu」→ 直接安裝(推薦)
原文外掛簡介
The Foundation Top Bar Navigation Menu plugin allows theme developers to display a WordPress menu as a responsive Foundation top bar. The plugin includes the following core functions:
A walker that applies Foundation top bar classes to a menu or page list
Registration of a default “Top Bar” menu location
The ability to include a basic version of Foundation that supports the top bar
Visit Zurb Foundation to learn more about the Foundation top bar and to view an example.
Usage
Download and include the Foundation framework in your theme (or load the basic version included with the plugin — see Notes below.)
Assign a new or existing WordPress menu into the “Top Bar” menu location. (or use ‘wp_list_pages’ to display a list of pages as a top bar — see below.)
Edit your theme’s templates to display the top bar menu where you’d like it to appear. Use WordPress’ ‘wp_nav_menu’ function to display the top bar menu:
'topbar',
'container' => false,
'walker' => new ftb_menu()
));
}
?>
A list of pages can be displayed instead of a menu using the ‘wp_list_pages’ function:
'',
'walker' => new ftb_pages()
));
?>
Notes
The ftb_menu() and ftb_pages() walkers both accept a single ‘no_wrap’ argument. Including this argument will remove the default top bar HTML wrapper and display just the
- unordered list.
‘wp_nav_menu() -> theme_location’ argument can be set to any registered menu area.
This plugin optionally includes a basic version of Foundation 5.5.2 that contains only top bar support. It is recommended that Foundation be included directly in your theme instead of using this basic version. To load the plugin’s basic version in your theme set “Load Foundation Basic in Theme” to “true” in the “Settings -> General” admin screen.
Visit Zurb Foundation to download Foundation and to view installation and usage documentation.
Default WordPress menu classes are not included in outputted top bar HTML.
Notes
Top bar styling is the default included with the Foundation framework. Some customization is possible using Foundation and/or WordPress methods, but any customizations must be implemented by theme developers.
This plugin is developed using Zurb Foundation version 5.5.2.
