首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >子页面不会成为子菜单(就像二十十个主题中的那样)?

子页面不会成为子菜单(就像二十十个主题中的那样)?
EN

WordPress Development用户
提问于 2011-02-14 09:16:24
回答 1查看 1K关注 0票数 0

我使用的主题是Starkers,它是基于二十十个。“我的二十十个主题”将子页面放在其父页面下面。但是我正在开发的新主题(基于Starkers)并没有(它只是把它放在了第一层)。

我的主题header.php

代码语言:javascript
复制
    <div id="access" role="navigation">
        <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
        </div><!-- #access -->
        <div id="branding">
            <h1>
                <?php if (get_option(THEME_PREFIX . "logo_image_enabled")) { ?>
                     <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/<?php echo get_option(THEME_PREFIX . 'logo_image'); ?>" /></a>
                <?php } else { ?>
                    <a href="<?php bloginfo('url'); ?>"><?php echo get_option(THEME_PREFIX . "logo_text"); ?></a>
                <?php } ?>
            </h1>
        </div><!-- #branding -->

二十十个:

代码语言:javascript
复制
    <div id="access" role="navigation">
          <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
            <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></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( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
        </div><!-- #access -->

我的主题的输出:

代码语言:javascript
复制
<div id="access" role="navigation">

<div class="menu">
    <ul>
     <li class="current_page_item"><a href="http://localhost/bf3/" title="Home">Home</a></li>
     <li class="page_item page-item-23"><a href="http://localhost/bf3/?page_id=23"   title="Blog">Blog</a></li>
     <li class="page_item page-item-63"><a href="http://localhost/bf3/?page_id=63" title="Home  sub">Home sub</a></li>
    </ul>
</div>

</div><!-- #access -->

二十几岁:

代码语言:javascript
复制
<div id="access" role="navigation">
<div class="skip-link screen-reader-text"><a href="#content" title="Skip to content">Skip to content</a></div>
<div class="menu-header">
 <ul id="menu-custom-menu" class="menu">
  <li id="menu-item-66" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-66"><a href="http://localhost/bf3/?page_id=23">Blog</a></li>
  <li id="menu-item-67" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-2 current_page_item menu-item-67"><a href="http://localhost/bf3/">Home</a>
 <ul class="sub-menu">
  <li id="menu-item-65" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-65"><a href="http://localhost/bf3/?page_id=63">Home sub</a></li>
 </ul>
</li>
</ul></div>         
</div><!-- #access -->

二十十个在类.sub-menu中添加一个无序列表。我的functions.php是直接从二十十个拿来的。

有人知道哪个文件和部分使子页面子菜单在标题的wp_nav_menu部分?

EN

回答 1

WordPress Development用户

回答已采纳

发布于 2011-02-14 22:32:27

检查二十十个主题函数文件,应该有一个函数来注册菜单。在将它添加到您的主题之后,您将在管理面板的外观下有一个新的选项卡,名为menu,您可以在其中设置菜单的项和子项。

文件

中的第96行

代码语言:javascript
复制
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'twentyten' ),
) );
票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/9300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档