我的自定义Wordpress布局需要帮助。 它看起来应该是这样的(HTML):
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li>
<a href="#about">About</a>
</li>
<li>
<a href="#services">Services</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</ul>
</div>
在Wordpress中:
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul>
<li class="page_item page-item-2"><a href="http://127.0.0.1/wordpress/?page_id=2">Test/Site</a></li>
</ul>
</div>
我的代码:
<?php
wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'collapse navbar-collapse navbar-ex1-collapse' ) );
?>
答案 0 :(得分:1)
我想 此
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'collapse navbar-collapse navbar-ex1-collapse' ) ); ?>
应该是:
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse', ''menu_class'=>'nav navbar' ) ); ?
&GT;
可能会有所帮助:
$args = array(
'theme_location' => 'primary'
'items_wrap' => '<ul class="nav nav-menu">%3$s</ul>',
'walker' => '',
)
虽然未经过测试
答案 1 :(得分:1)