我試圖在ul上顯示wordpress導航列表,但它不顯示,如果我在列表項中顯示另一個單詞,我無法識別問題!Wordpress導航列表不顯示
這裏是我的代碼: HTML
<div class="menu-toggle">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
</div>
<nav class="toggle-navg">
<ul role="navigation" class="hidden">
<li> <?php wp_nav_menu(array('theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class')); ?></li>
</ul>
</nav>
</div>
和CSS
.menu-toggle {
width: 40px;
height: 30px;
position: absolute;
top: 20px;
left: 25px;
cursor: pointer;
z-index:99;
}
.menu-toggle.on .one {
-moz-transform: rotate(45deg) translate(7px, 7px);
-ms-transform: rotate(45deg) translate(7px, 7px);
-webkit-transform: rotate(45deg) translate(7px, 7px);
transform: rotate(45deg) translate(7px, 7px);
}
.menu-toggle.on .two {
opacity: 0;
}
.menu-toggle.on .three {
-moz-transform: rotate(-45deg) translate(8px, -10px);
-ms-transform: rotate(-45deg) translate(8px, -10px);
-webkit-transform: rotate(-45deg) translate(8px, -10px);
transform: rotate(-45deg) translate(8px, -10px);
}
.one,
.two,
.three {
width: 100%;
height: 5px;
background: white;
margin: 6px auto;
backface-visibility: hidden;
-moz-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.toggle-navg ul {
margin: 0;
padding: 0;
font-family: Open Sans;
list-style: none;
margin: 4em auto;
text-align: center;
}
.toggle-navg ul.hidden {
display: none;
}
.toggle-navg ul a {
-moz-transition-duration: 0.5s;
-o-transition-duration: 0.5s;
-webkit-transition-duration: 0.5s;
transition-duration: 0.5s;
text-decoration: none;
color: black;
font-size: 3em;
line-height: 1.5;
width: 100%;
display: block;
}
.toggle-navg ul a:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.menu-section.on {
z-index: 10;
width: 100%;
height: 100%;
display: block;
background-color: rgba(0, 0, 0, 0.8);
position: absolute;
opacity: 0.7;
}
.menu-toggle {
left: 85%;
}
顯示我們也是*渲染HTML *。有可能你的菜單是空的,在這種情況下,沒有任何東西可以顯示,解決方案是確保你的菜單是建立的,並且你的'theme_location'匹配。 –
你可以檢查元素,HTML是不是來了 – Samyappa