2

我正在尝试将我的静态网站移植到基于 wordpress 的网站,这样我就可以轻松地制作博客、新闻和 RSS 提要。我遇到了一个问题,但是在使用 bootstraps navbar-fixed-top 插件时。我无法让它正确放置,所有内容都与页面的最左侧对齐,图像没有显示,我整天都在胡闹,没有任何结果。有人可以帮帮我吗?

这是我的wordpress代码:

  <div class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#"><img src="img/logo-menu.png" ></a>
    </div>
<nav class="navbar navbar-default navbar-fixed-top">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'container_class' =>   'navbar-collapse collapse', 'items_wrap' => '<ul class="nav navbar-nav">%3$s</ul>' ) ); ?>
</div>
</nav>

这是来自我的静态网站的代码:

    <nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#"><img src="img/logo-menu.png" ></a>
    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="index.php">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#projects">Projects</a></li>
        <li><a href="blog.php">Blog</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</nav>
4

1 回答 1

1

我想通了,以下方法适用于陷入类似情况的任何人,代码如下:

  <!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#"><img src="img/logo-menu.png" ></a>
    </div>
    <div class="navbar-collapse collapse">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'container_class' => 'navbar-collapse collapse', 'items_wrap' => ' <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav">%3$s  </ul>
    </div><!--/.nav-collapse -->' ) ); ?></nav>
于 2013-10-01T11:37:59.787 回答