我正在尝试从包含的html主题添加CSS。
当我添加我定义的加载菜单部分的主菜单函数时,我不知道如何包含CSS,因为它返回一个defultul
风格
注意:我正确地实现了我的风格,因为在我添加这个功能之前它一直有效。
<header class="header_area">
<div class="main_menu">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container box_1620">
<a class="navbar-brand logo_h" href="index.html"><img src="img/logo.png" alt=""></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse offset" id="navbarSupportedContent">
<?php
if (has_nav_menu(\'primary\')) {
wp_nav_menu(array(
\'theme_location\' => \'primary\',
\'container\' => false,
\'fallback_cb\' => false,
\'depth\' => 5
));
}
?> ...
我的基本功能:
function ju_setup_theme() {
register_nav_menu( \'primary\',
__( \'Primary Menu\', \'lorahost\' )
);
}
第一部分改变了:
<div class="collapse navbar-collapse offset" id="navbarSupportedContent">
<ul class="nav navbar-nav menu_nav justify-content-end">
<li class="nav-item active"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="feature.html">Features</a></li>
<li class="nav-item"><a class="nav-link" href="service.html">Service</a>
<li class="nav-item"><a class="nav-link" href="pricing.html">Pricing</a>
<li class="nav-item submenu dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Pages</a>
<ul class="dropdown-menu">
<li class="nav-item"><a class="nav-link" href="blog.html">Single Blog</a>
<li class="nav-item"><a class="nav-link" href="blog-details.html">Blog Details</a>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="contact.html">Contact</a></li>
</ul>
如何正确加载CSS?也许是因为争吵?
SO网友:simongcc
看看我是否正确理解你的意思。有关参数详细信息,请参阅wp_nav_menu()
调用菜单时,可以添加以下参数:
wp_nav_menu(array(
\'theme_location\' => \'primary\',
\'container\' => \'div\', // default is div anyway, you set it false because you want to add ID, right?
\'container_id\' => \'container_id\', // container id here, css ID for container above
// comment out if you need
// \'menu_class\' => \'menu-class-here\', // menu class
// \'menu_id\' => \'menu-id-here\',
\'fallback_cb\' => false,
\'depth\' => 5
));