如何使 Jet - Responsive Megamenu 与 Wordpress 兼容?
How to make Jet - Responsive Megamenu compatible with Wordpress?
Jet - Responsive Megamenu 与 Wordpress 兼容吗?
如果不是,我怎样才能让它与 Wordpress 菜单系统一起使用?
下面是使菜单在 Wordpress 上运行的代码。它在 Wordpress 4.3 上测试过,但我认为它适用于 Wordpress 3.2+(我不是 100% 确定)。
<?php
/* Put this script inside header.php in Wordpress theme folder */
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array()) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"dropdown\">\n";
}
}
$menuSettings = array(
'container' => 'div',
'menu_class' => 'jetmenu yellow', //change this to whatever classes you need for your menu
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'items_wrap' => '<ul id="%1$s" class="%2$s dropdown">%3$s</ul>',
'depth' => 3, //the number of submenus + 1
'walker' => new My_Walker_Nav_Menu()
);
wp_nav_menu( $menuSettings ); //This script displays the menu. Please put it where you want it to display the menu.
?>
我希望这能解决某人的问题。
Jet - Responsive Megamenu 与 Wordpress 兼容吗? 如果不是,我怎样才能让它与 Wordpress 菜单系统一起使用?
下面是使菜单在 Wordpress 上运行的代码。它在 Wordpress 4.3 上测试过,但我认为它适用于 Wordpress 3.2+(我不是 100% 确定)。
<?php
/* Put this script inside header.php in Wordpress theme folder */
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array()) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"dropdown\">\n";
}
}
$menuSettings = array(
'container' => 'div',
'menu_class' => 'jetmenu yellow', //change this to whatever classes you need for your menu
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'items_wrap' => '<ul id="%1$s" class="%2$s dropdown">%3$s</ul>',
'depth' => 3, //the number of submenus + 1
'walker' => new My_Walker_Nav_Menu()
);
wp_nav_menu( $menuSettings ); //This script displays the menu. Please put it where you want it to display the menu.
?>
我希望这能解决某人的问题。