Jet - 响应式Megamenu与Wordpress兼容吗? 如果不能如何使用Wordpress菜单系统?
答案 0 :(得分:0)
下面是让您的菜单适用于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.
?>
我希望这能解决某人的问题。