【问题标题】:How to change a complex menu to a simple textual menu如何将复杂菜单更改为简单的文本菜单
【发布时间】:2012-01-15 14:31:10
【问题描述】:

在我当前的 wordpress 主题中,存在以下菜单:

我希望它只是一个简单的基于文本的菜单,如下所示:

这里是菜单的 style.css:

/* =Menu
-------------------------------------------------------------- */

#access {
    background: #ffffff; /* Show a solid color for older browsers */
}
#access ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 -0.8125em;
    padding-left: 0;
}
#access li {
    float: left;
    position: relative;
}
#access a {

}
#access ul ul {

}
#access ul ul ul {

}
#access ul ul a {

}
#access a:focus {
}
#access li:hover > a,
#access a:focus {
}   
#access ul li:hover > ul {
}
#access .current_page_item > a,
#access .current_page_ancestor > a {
    font-weight: bold;
}

这是当前菜单的 php 代码。我不知道如何在不破坏它的情况下拆卸它。提前感谢您的帮助。

<nav id="access" role="navigation">
                <h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
                <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
                <div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
                <div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
                <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
                <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
            </nav><!-- #access -->

【问题讨论】:

  • 如果您打算使用完全不同的菜单,您不妨考虑使用完全不同的主题。 Wordpress 在wordpress.org/extend/themes 有一个画廊。

标签: css wordpress menu wordpress-theming


【解决方案1】:

您可以通过修改传递给函数调用的数组来删除包含导航菜单的 HTML。阅读更多:wp_nav_menu#removing the navigation container

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 2014-05-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多