0

我有一个 HTML 编码的导航菜单,它有CSS样式和很酷的动画。现在我想CSSWord Press. 我已经尝试过并且也使用过wp_nav_menu()。但结果到目前为止。我怎么能在 Word Press 中使用这个 CSS。如果我使用静态导航,CSS 也包括在内并且工作正常HTML

$defaults = array(
                    'theme_location'  => 'header-menu',
                    'menu'            => '',
                    'container'       => 'div',
                    'container_class' => '',
                    'container_id'    => '',
                    'menu_class'      => 'menu',
                    'menu_id'         => '',
                    'echo'            => true,
                    'fallback_cb'     => 'wp_page_menu',
                    'before'          => '',
                    'after'           => '',
                    'link_before'     => '',
                    'link_after'      => '',
                    'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
                    'depth'           => 0,
                    'walker'          => ''
                );

                wp_nav_menu( $defaults );

想在 Wordpress 导航菜单中添加这个 css

 <ul class="menu">
                            <li class="current-menu-parent"><a href="javascript:void(0)" title="Lorem ipsum vivams vitae sodales">Home</a>
                                <ul class="sub-menu">                        
                                    <li class="current-menu-item"><a href="home.html">Background Color</a></li>
                                    <li><a href="home2.html">Background Color With Fullwidth Slider</a></li>
                                    <li><a href="home3.html">Clean Style</a></li>
                                    <li><a href="home4.html">Clean Style With Fullwidth Slider</a></li>
                                    <li><a href="home5.html">Background Image</a></li>
                                </ul>
                            </li>
                            <li><a href="javascript:void(0)" title="Egestas cras eres mauri pellentesque">Pages</a>
                                <ul class="sub-menu">
                                    <li><a href="about.html">About</a></li>
                                    <li><a href="full-width.html">Full Width</a></li>
                                    <li><a href="gallery.html">Gallery</a></li>
                                    <li><a href="404.html">404 Page</a></li>
                                    <li><a href="sitemap.html">Sitemap</a></li>
                                </ul>                        
                            </li>
    </ul>
4

1 回答 1

1

做到这一点并不难。您需要在数组中声明菜单的类。这是一个例子:

 <?php $defaults = array(
    'theme_location'  => '',
    'menu'            => 'TopMenu', 
    'container'       => 'ul', 
    'container_class' => 'topmenu-{topmenu slug}-container', 
    'container_id'    => 'topmenu',
    'menu_class'      => 'topmenu', 
    'menu_id'         => 'topmenu-{topmenu slug}[-{increment}]',
    'echo'            => true,
    'fallback_cb'     => 'wp_page_menu',
    'before'          => '',
    'after'           => '',
    'link_before'     => '',
    'link_after'      => '',
    'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    'depth'           => 0,
    'walker'          => ''
); ?>
<?php wp_nav_menu( $defaults ); ?>  

在这个“顶级菜单”中是 css 类。我相信从这里您将能够自定义您的菜单。

希望对你有帮助!如果您需要 CSS 示例,请告诉我!

于 2013-05-10T10:06:22.330 回答