我使用的主题是Starkers,它是基于二十十个。“我的二十十个主题”将子页面放在其父页面下面。但是我正在开发的新主题(基于Starkers)并没有(它只是把它放在了第一层)。
我的主题header.php:
<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 -->二十十个:
<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 -->我的主题的输出:
<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 -->二十几岁:
<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部分?
发布于 2011-02-14 22:32:27
检查二十十个主题函数文件,应该有一个函数来注册菜单。在将它添加到您的主题之后,您将在管理面板的外观下有一个新的选项卡,名为menu,您可以在其中设置菜单的项和子项。
中的第96行
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
) );https://wordpress.stackexchange.com/questions/9300
复制相似问题