wordpress中的自定义菜单未进行样式设置

时间:2015-03-18 11:54:43

标签: php css wordpress

所以我试图在我的wordpress主题中添加一个自定义菜单,我从头开始创建(借助在线教程)。我已经创建了菜单,为我的主题添加了位置,现在有链接显示在我的主题中,但它们根本没有被设置样式。这就是我的functions.php文件的样子:

<?php

    add_theme_support ('menus');

    function register_theme_menus () {

        register_nav_menus(
             array (
                    'primary-menu' => _('Primary Menu')  
             )
        );
    };

add_action ('init', 'register_theme_menus');

function twp_theme_styles() {

     wp_enqueue_style ('normaliz_css', get_template_directory_uri() . '/css/normaliz.css');

     wp_enqueue_style ('normaliz_css', get_template_directory_uri() . '/css/normaliz.css');

     wp_enqueue_style ('googlefont', 'http://fonts.googleapis.com/css?family=Oswald' );

     wp_enqueue_style ('main_css', get_template_directory_uri() . '/style.css');
}

add_action ('wp_enqueue_scripts', 'twp_theme_styles');

?>

这里是我在我的CSS中放置wp_nav_menu()函数的地方:

    <?php

             $defaults = array(
                'containter' => 'nav',
                'container_id' => 'mainNav',
                'theme_location' => 'primary-Menu',
                'menu_id' => 'mainNavUl'
             );

             wp_nav_menu($defaults);

    ?>  
         <!--
               <nav id="mainNav">


                   <ul id="mainNavUl">
                       <li class="mainNavLi"><a href="homePage.html">Home</a></li>
                       <li class="mainNavLi"><a href="">HTML</a>
                            <ul class="subNavUl">
                                <li class="subNavLi"><a href="">Beginner</a></li>
                                <li class="subNavLi"><a href="">Intermediate</a></li>
                                <li class="subNavLi"><a href="">Advanced</a></li>
                            </ul>
                       </li>
                       <li class="mainNavLi"><a href="">CSS</a>
                            <ul class="subNavUl">
                                <li class="subNavLi"><a href="">Beginner</a></li>
                                <li class="subNavLi"><a href="">Intermediate</a></li>
                                <li class="subNavLi"><a href="">Advanced</a></li>
                            </ul>
                       </li>
                       <li class="mainNavLi"><a href="">Javascript</a>
                            <ul class="subNavUl">
                                <li class="subNavLi"><a href="">Beginner</a></li>
                                <li class="subNavLi"><a href="">Intermediate</a></li>
                                <li class="subNavLi"><a href="">Advanced</a></li>
                            </ul>
                       </li>
                   </ul>

               </nav>
              -->

我已经注释掉了我原来的CSS,因为这是教程推荐的内容。有什么想法吗?任何帮助都有很大的帮助。

0 个答案:

没有答案