Wordpress <ul>类引用问题</ul>

时间:2012-10-11 17:46:01

标签: wordpress list navigation

我似乎无法弄清楚如何在导航菜单中为标签调用类...我正在使用wp_nav_array引用,但它似乎不起作用。这是标记:

HTML

<div class="navigation_bar">
    <ul class="navigation">
        <li><a href="index.html">Home</a></li>
        <li class="active"><a href="about.html">About</a></li>
        <li><a href="portfolio.html">Portfolio</a></li>
        <li><a href="blog.html">Blog</a></li>
        <li><a href="contact.html">Contact</a></li>
    </ul>
</div>

Header.php文件

            <?php wp_nav_menu(array( 'menu_class' => 'navigation_bar navigation', 'sort_column' => 'menu_order', 'theme_location'  => 'header-menu') ); ?>

它在浏览器中的显示方式

<div class="navigation_bar">
    <ul>
       <li class="page_item page-item-6"><a href="http://localhost/?page_id=6">Home</a></li>
       <li class="page_item page-item-12 current_page_item"><a href="http://localhost/?page_id=12">About</a></li>
    </ul>
</div>

如何在浏览器中显示

<div class="navigation_bar">
    <ul class="navigation">
       <li class="page_item page-item-6"><a href="http://localhost/?page_id=6">Home</a></li>
       <li class="page_item page-item-12 current_page_item"><a href="http://localhost/?page_id=12">About</a></li>
    </ul>
</div>

我感谢所有的建议。感谢。

1 个答案:

答案 0 :(得分:0)

这应该可以解决问题:

<?php wp_nav_menu(array('menu_class' => 'navigation_bar', 'container_class' => 'navigation', 'sort_column' => 'menu_order', 'theme_location' => 'header-menu') ); ?>

有关致电WP Nav Menu

的更多信息

<强>更新

仔细观察后,我意识到wp_nav_menu没有'sort_column'选项。像这样称呼它:

<?php wp_nav_menu(array('menu_class' => 'navigation_bar', 'container_class' => 'navigation', 'theme_location' => 'header-menu') ); ?>