2013-09-30 47 views
1

我試圖將我的靜態網站移植到一個基於WordPress的網站,所以我可以輕鬆地做博客,新聞和RSS源。但是,當我使用bootstraps navbar-fixed-top插件時,我遇到了一個問題。我無法正確定位,所有內容都與頁面最左側對齊,圖像沒有顯示出來,而我一整天都在亂搞,沒有結果。有人可以幫我嗎?WordPress的一體化引導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> 
+0

我設法弄清楚了這一點。對於任何正在爲類似情況而苦惱的人,下面的代碼可以工作: –

回答

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>