我正在尝试自定义wordpress主题。在header.php中,它检查某个区域中是否存在菜单,如果没有菜单,则该菜单应该不显示任何内容。然而,即使那里没有菜单,该地区仍然出现。感谢任何建议,谢谢!
<nav id="resurrect-header-menu" class="resurrect-clearfix">
<div id="resurrect-header-menu-inner" class="resurrect-clearfix">
<?php
wp_nav_menu( array(
'theme_location' => 'header',
'menu_id' => 'resurrect-header-menu-links',
'menu_class' => 'sf-menu',
'container' => false, // don't wrap in div
'fallback_cb' => false, // don't show pages if no menu found - show nothing
'walker' => new CTFW_Walker_Nav_Menu_Description
) );
?>
</div>
</nav>
答案 0 :(得分:0)
请试试。
<div id="resurrect-header-menu-inner" class="resurrect-clearfix">
function toggle_visibility(news) {
var e = document.getElementById(news);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
&#13;
<a href="#" onclick="toggle_visibility
('menu');">Menu</a>
<span id="menu" style="display:none;color:
#00ccff;">
<a href="">remove me 1</a><br>
<a href="">remove me 2</a><br>
Put here your php code...
</span>
&#13;