使用自定义类在wordpress中创建下拉菜单

时间:2016-03-03 17:16:23

标签: php html css wordpress

我正在尝试创建一个下拉菜单,并在线搜索没有运气。我已经将自定义类添加到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 );

任何帮助将不胜感激!我尝试过使用插件,似乎什么都没有用!

1 个答案:

答案 0 :(得分:0)

你特意要使用wordpress吗?您也可以使用CSS执行此操作,这可能会更容易。

相关问题