此刻,我正在将HTML转换为Wordpress。不管我尝试什么,我似乎都无法使菜单看起来相同 与HTML一样的Wordpress。 CSS是正确的(已排除故障以将其根除)。这是HTML:
<div class="navbar-wrapper">
<div class="navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"> Toggle navigation </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img src="assets/img/Logo%20BY.png" alt="Logo" height="75" width="75"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/">Home</a></li>
<li><a href="onzediensten.html">Onze diensten</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
这是我尝试实现的Wordpress方法:
<div class="navbar-wrapper">
<div class="navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"> Toggle navigation </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/Logo%20BY.png" alt="Logo" height="75" width="75">
</a>
</div>
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => 'nav',
'container_class' => 'navbar-collapse collapse',
'menu_class' => 'nav navbar-nav navbar-right'
));
?>
</div>
</div>
</div>
预先感谢您的帮助!
答案 0 :(得分:0)
我怀疑您缺少容器div。右键单击并检查格式不正确的菜单,然后查看(容器)div是否存在
<div class="navbar-collapse collapse">
你有
'container' => 'nav'
应该是
'container' => 'div'