0
我想創建一個下拉菜單,並在網上搜索廣泛,沒有運氣。我已經添加了自定義類到wp_nav_menu並嘗試添加自定義CSS,但我似乎無法使其工作。在wordpress中使用自定義類創建一個下拉菜單
,這裏是我的header.php
<div id="menu">
<ul>
<li id="access"><?php wp_nav_menu(array('sort_column' => 'menu_order', 'container_class' => 'dropdown', 'container_id' => 'menu-header',)); ?></li>
</ul>
</div>
,這裏是我的style.css
.black-line{
background-color: #000;
width: 100%;
height: 6px;
}
a:hover{
text-decoration: none !important;
color: #000 !important;
}
#menu {
width: 550px;
height: 35px;
font-size: 16px;
text-align: center;
border-radius: 8px;
height: auto;
padding: 8px 0px;
margin: 0px;
display: inline;
}
#menu li {
display: inline;
padding: 20px;
margin:0 auto;
font-weight: bold;
}
.menu-item-28{
background-color: #7ED321;
border-radius: 13px;
}
ul li a{
color:#000;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
footer{
border-top: 1px solid #DBDBDB;
margin-top:15px;
}
.coming{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
}
.spacing{
padding-left: 9px;
margin-right: 5px;
margin-top: 10px;
}
.social-and-coming{
margin-top: 10px;
}
p.coming{
font-size: 15px;
}
.copy{
padding-bottom: 15px;
}
.footer{
margin-bottom: 10px;
}
footer{
margin-top: 29px;
}
我可能會覆蓋在我的CSS東西是阻止我從創建一個。
,這裏是我的functions.php
function register_my_menus() {
register_nav_menus(
array(
'primary' => __('Primary Menu', 'Creativeforces'),
'header-menu' => __('Header Menu'),
'extra-menu' => __('Extra Menu')
)
);
}
add_action('init', 'register_my_menus');
$defaults = array(
'default-image' => '',
'width' => 0,
'height' => 0,
'flex-height' => false,
'flex-width' => false,
'uploads' => false,
'random-default' => false,
'header-text' => true,
'default-text-color' => '',
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support('custom-header', $defaults);
任何幫助,將不勝感激!我曾嘗試使用插件,似乎沒有任何工作!
不,我不知道。我只是不確定如何通過使用動態wordpress頁面的CSS來做到這一點。 – avasssso