问候, 我试图设置类别列表,我不知道我必须搜索什么和&所以我有这个HTML代码样式与bootstrap wp_list_categories();
<nav class="navbar navbar-expand-lg navbar-dark our-color fixed-top">
<div class="container"> <a class="navbar-brand" href="#"> <img src="<?php bloginfo('template_directory'); ?>/images/logo-woocommerce-white.png" width="150" height="30" alt=""> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto s">
<li class="nav-item active bold"> <a class="nav-link" href="#">الرئيسية<span class="sr-only">(current)</span> </a> </li>
<?php wp_list_categories(); ?>
<li class="nav-item bold"> <a class="nav-link" href="#">خدمات</a> </li>
<li class="nav-item bold"> <a class="nav-link" href="#">اتصل بنا</a> </li>
</ul>
</div>
</div>
</nav>
我想在这个类中导入WP的类别&gt;如果我把它放在div中它不会影响列表,我必须做什么!
答案 0 :(得分:0)
您可以按照以下方式设置样式
li{
list-style-type:none;
padding:10px;
border-radius:4px;
background:black;
margin-bottom:2px;
}
li a{
color:#fff;
text-decoration:none;
}
li:hover{
background:red;
transition:all 0.3s;
color:#fff;
}
&#13;
<nav class="navbar navbar-expand-lg navbar-dark our-color fixed-top">
<div class="container"> <a class="navbar-brand" href="#"> <img src="<?php bloginfo('template_directory'); ?>/images/logo-woocommerce-white.png" width="150" height="30" alt=""> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto s">
<li class="nav-item active bold"> <a class="nav-link" href="#">الرئيسية<span class="sr-only">(current)</span> </a> </li>
<?php wp_list_categories(); ?>
<li class="nav-item bold"> <a class="nav-link" href="#">خدمات</a> </li>
<li class="nav-item bold"> <a class="nav-link" href="#">اتصل بنا</a> </li>
</ul>
</div>
</div>
</nav>
&#13;
希望这会奏效。祝一切顺利。如有任何疑问,请发表评论