0

I'm using the theme Starkers, which is based on twentyten. My twentyten theme places child pages below its parent page. But the new theme (based on Starkers) I'm developing doesn't (it just places it in the first level).

My theme 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 -->

Twentyten's:

    <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 -->

My theme's output:

<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 -->

Twenty-ten's:

<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 -->

Twentyten adds an unordered list with the class .sub-menu. My functions.php was directly taken from twentyten's.

Does anybody know which file and section makes the child pages sub-menus in the wp_nav_menu part of the header?

2
  • Is the HTML output the same? I believe Starkers does not include any CSS, and the menu is laid out using CSS.
    – Jan Fabry
    Feb 14 '11 at 9:36
  • Fabry Twenty-ten adds a unordered list with the class .sub-menu (I added the output).
    – janoChen
    Feb 14 '11 at 9:43
1

Check the twenty ten themes function file, there should be a function to register menus. After adding it to your theme you'll have a new tab in your admin panel under appearance called menu where you can set the menu's items and sub items.

Line 96 in the functions.php file

// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'twentyten' ),
) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.