簡體   English   中英

使用自定義類在wordpress中創建下拉菜單

[英]creating a dropdown menu in wordpress using custom classes

我正在嘗試創建一個下拉菜單,並且在網上沒有進行過大量搜索。 我已經將自定義類添加到wp_nav_menu並嘗試添加自定義css,但是我似乎無法使其工作。

這是我的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來做到這一點,這可能會更容易。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM