使用引导wp_NAV_MENU添加子菜单

时间:2015-02-14 作者:Luciano Oliveira

我在使用wp\\U nav\\U菜单生成子菜单时遇到问题。如何更改由wp\\U nav\\U菜单为ClassA引导程序生成的ClassA子菜单?

查看我的问题:

enter image description here

这是我生成菜单的代码:

<nav class="row menu">
        <?php wp_nav_menu( array( 
            \'theme_location\'      => \'category-menu\',
            \'container\'             => \'\',
            \'container_class\'   => \'\',
            \'container_id\'      => \'main-navbar-collapse\',
            \'menu_class\'        => \'nav nav-pills\',
            \'menu_id\'           => \'\',
            \'echo\'              => true,
            \'fallback_cb\'       => \'wp_page_menu\',
            \'before\'            => \'\',
            \'after\'             => \'\',
            \'link_before\'       => \'\',
            \'link_after\'        => \'\',
            \'items_wrap\'        => \'<ul id="%1$s" class="%2$s">%3$s</ul>\',
            \'depth\'             => 0,
            \'walker\'            => \'\'
           )); ?>
    </nav>      
如何为ClassA下拉引导修改它?

1 个回复
SO网友:Vino

您需要编写一个自定义菜单漫游器。

看见this code 对于步行者。(或搜索“Bootstrap Menu Walker”。)

然后使用:

    wp_nav_menu( array(
      \'menu\' => \'header\',
      \'menu_class\' => \'nav nav-pills\',
      \'container\' => \'nav\',
      \'container_class\' => $classes,
      \'fallback_cb\' => false,
      \'depth\' => 2,
      \'walker\' => new Bootstrap_Walker_Menu_Nav(),
      \'theme_location\' => \'header\',
      \'echo\' => false,
      ));

结束

相关推荐

WP_DROPDOWN_ROLES()替换选项值=CODE

我正在尝试替换插件中角色的硬编码下拉列表。目前代码如下:echo \'<select name=\"xf_user_role_\' . $id . \'\" id=\"xf_user_role_\' . $id . \'\">\'; ?> <option value=\'subscriber\' <?php echo ($xf_options[\'xf_user_role\'][$id] == \'subscriber\') ? \"sele