Html 下拉导航不使用引导&;Wordpress

Html 下拉导航不使用引导&;Wordpress,html,twitter-bootstrap,wordpress-theming,Html,Twitter Bootstrap,Wordpress Theming,我正在使用bootstrap为wordpress网站创建页面模板,但当我在wordpress菜单屏幕中添加一个子菜单时,我很难让下拉导航正常工作 这是我的头代码 <body id="grad1"> <div class="mynavbar"> <div class="row"> <div class="col-md-3 col-sm-3 col-xs-1">

我正在使用bootstrap为wordpress网站创建页面模板,但当我在wordpress菜单屏幕中添加一个子菜单时,我很难让下拉导航正常工作

这是我的头代码

  <body id="grad1">
<div class="mynavbar">
            <div class="row">
                <div class="col-md-3 col-sm-3 col-xs-1">
                <img src="/wp-content/uploads/2015/07/logo_80px.png" class=" center-block space" alt="Enter OmniMark here"/>
                </div>
                <div class="col-md-6 col-sm-6 col-xs-0">

                </div>
                <div class="col-md-3 col-sm-3 col-xs-1">
                    <img src="/wp-content/uploads/2015/07/OMsemicircle.png" class=" center-block space" alt="Enter OmniMark here"/>
                </div>
             </div>
       </div>
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="row">
      <div class="container-fluid" id="fontfix">
<!-- Collect the nav links, forms, and other content for toggling -->
        <div class="center-block">
        <div class="collapse navbar-collapse column " id="navbar-collapse-2">

          <ul class="nav navbar-nav">
            <!--<li><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Services</a></li>
            <li><a href="#">Works</a></li>
            <li><a href="#">News</a></li>
            <li><a href="#">Contact</a></li>-->

            <?php /* Primary navigation */
wp_nav_menu( array(
  'menu' => 'menu 1',
  'depth' => 0,
  'container' => false,
  'container_class' => 'collapse navbar-collapse column',
  'container_id' => 'navbar-collapse-2',
  'menu_class' => 'nav navbar-nav',
  //Process nav menu using our custom nav walker
  'walker' => new wp_bootstrap_navwalker())
);
?>



            <!--Used to list nav and exclude pages-->
            <!--<?php wp_list_pages(array('title_li' => '', 'exclude' => '615, 14',)); ?>-->
            <li><a href="" alt="">Store</a></li>
           </ul>

  <!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="module top widewrapper center-block">

        <h1><span class="fontgreen">Thin Film</span><span class="fontblue"> Product Markings</span></h1>
        <p class="darktext">The world is full of products and brands whose image gets lost in the white noise of modern society. The Lauterbach Group protects your brand’s unique and inspiring image with film product markings. Thin film product markings provide exceptional decoration options, increased production efficiencies and supply chain savings with an environmental focus.</p>
    <!--<img class="center-block" src="/wp-content/uploads/2015/07/homepage_800.png" alt="" />-->

    </div>


    <div class="container mainbump">

薄膜产品标记

世界上充斥着产品和品牌,它们的形象在现代社会的白噪音中迷失。劳特巴赫集团通过电影产品标识保护您的品牌的独特和鼓舞人心的形象。薄膜产品标记提供了卓越的装饰选项,提高了生产效率,并以环保为重点节约了供应链成本

我也可以提供的功能代码,如果这将有助于

<?php 
//trying to register menu
/* Theme setup */
add_action( 'after_setup_theme', 'wpt_setup' );
    if ( ! function_exists( 'wpt_setup' ) ):
        function wpt_setup() {  
            register_nav_menu( 'primary', __( 'Primary navigation', 'wptuts' ) );
        } endif;

// Register custom navigation walker
    require_once('wp_bootstrap_navwalker.php');

//menu registery
function wpbootstrap_scripts_with_jquery()
{
    // Register the script like this for a theme:
    wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
    wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ) );
    wp_register_script( 'custom-script', get_template_directory_uri() . 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', array( 'jquery' ) );
    // For either a plugin or a theme, you can then enqueue the script:
    wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'name' => 'sidebar',
        'id' => 'sidebar',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ));


    register_sidebar(array(
        'name' => 'footer',
        'id' => 'footer',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ));

    register_sidebar(array(
        'name' => 'sidebarmenu',
        'id' => 'sidebarmenu',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ));




?>

数组中的“深度”值为0,如果需要更多,应将其更改为2或3

下面是Wordpress wp_bootstraap_navkwalker()函数的示例

    <nav class="navbar" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button"  class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div><!--end navbar-header-->
            <div class="collapse navbar-collapse menu-primary" id="bs-example-navbar-collapse-1">
                <?php
                wp_nav_menu( array(
                    'menu'              => '',
                    'theme_location'    => 'primary',
                    'depth'             => 3,
                    'container'         => '',
                    'container_class'   => 'collapse navbar-collapse',
                    'container_id'      => 'bs-example-navbar-collapse-1',
                    'menu_class'        => 'nav navbar-nav',
                    'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                    'walker'            => new wp_bootstrap_navwalker())
                );
                ?>

            </div><!--end navbar-colapse-->
        </div><!--end container-->
    </nav>

切换导航

试试看,你应该会很好。

我想我可能已经弄明白了,我在我的“菜单\类”“菜单\类”=>“导航导航栏导航栏默认导航栏固定顶部”