donglao9606 2015-02-18 04:39
浏览 61

bootstrap navbar不适用于wordpress

I've made wordpress theme by bootstrap last version but navbar will not work. i tried many different ways as play with wp_nav_menu(); codes and with ul , li 's but nothing worked!

Here is my header.php code:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<title><?php bloginfo( 'title' ); ?></title>
  <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta property="dc:creator" content="http://www.myvivaid.com/" />
    <meta name="geo.region" content="IR" />
    <meta name="googlebot" content="index,follow" />    
    <meta name="robots" content="noodp,noydir" />
    <meta name="robots" content="index, follow" />
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Raleway:400">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />

<div class="col-12">

<nav class="navbar navbar-default">
  <div class="container-fluid">

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <?php wp_nav_menu(); ?>
      </ul>
      <form class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

</div>
     <h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo( $show ); ?></a></h1>
<!--end menu-->
<?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>
</head>

<body>

and this is my footer.php:

<div class="col-md-12" id="footer">
        <div class="col-lg-3">
            <div class="spacer-1">
                <a href="index.html"><img src="<?php bloginfo('template_directory'); ?>/img/myviva_footer.png" alt="مای ویوا آی دی"></a>
            </div>
            </div>
                <div class="col-lg-5">
                <div class="indent-top2">
                    <p><span class="glyphicon glyphicon-copyright-mark" aria-hidden="true"></span> <a href="http://www.myvivaid.com/">طراحی قالب بصورت اختصاصی</a> توسط MyVivaId.com صورت گرفته و هرگونه کپی برداری از این طرح با نارضایتی <a href="http://webmaker.ga/">طراح</a> همراه می باشد.</p>
                    <p><span class="glyphicon glyphicon-heart" aria-hidden="true"></span> <a href="http://webmaker.ga/">سفارش طراحی قالب</a><p>
                </div>
            </div>
            <div class="col-lg-4">
                <ul class="list-services">
                    <li><a href="https://www.facebook.com/pages/Myvivaid/1593182370893821"><i class="fa fa-facebook-square fa-2x"></i></a></li>
                    <li><a href="https://twitter.com/myvivaid"><i class="fa fa-twitter-square fa-2x"></i></a></li>
                    <li><a href="https://plus.google.com/113198960466603112632"><i class="fa fa-google-plus-square fa-2x"></i></a></li>
                    <li><a href="http://myvivaid.com/feed/"><i class="fa fa-rss-square fa-2x"></i></a></li>
                </ul>
                <span class="footer-text">&copy; 2015 <a class="link color-2" href="#">تمام حقوق محفوظ</a></span>
            </div>
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
            <script src="<?php echo esc_url( get_template_directory_uri() . '/js/bootstrap.min.js' ); ?>"></script>
            <?php wp_footer(); ?>
</div>
<a href="#top" id="smoothup" title="Back to top"></a>
</body>
</html>

</div>
  • 写回答

4条回答 默认 最新

  • duan88014 2015-02-18 05:26
    关注

    you had add in wp_nav_menu function class name , theme name and all those things after that it will display on bootstrap menu as a dropdown like that.

    Please refer this menu function name and apply in to your code.

    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    评论

报告相同问题?

悬赏问题

  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题