Support » Fixing WordPress » Creating Sub Page Menu

  • I need to create a menu like this on top of the page:

    Main Menu: Page 1 | Page 2 | *Page 3 | Page 4
    Sub Menu: ChildPage31 | ChildPage32 | ChildPage34

    If i’m in page “Page 3”, I have to highlight “Page 3” and list all its subpages.

    And again if i’m in a child page say ‘ChildPage31’ i have to highlight the parent page link “Page 3”

    Please show some light code this thing using WP!


Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey, this is a BIG bump? Any help. Cuz I would like to use a sub menu with dynamic highlighting. Man, this must be the WordPress weakness of the century.

    Found this link for listing of sub pages:
    “List subpages even if on a subpage “

    I’ve also been using Fold page listing pages. Which is similar, but what you describe.


    This seems to work for me:


    <!-- Main Menu -->
    <div id="mainmenu">
    	<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
    </div><!-- / Mainmenu -->
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      if ($children) { ?>
    <!-- Sub Menu -->
    <div id="submenu">
      <?php echo $children; ?>
      </div> <!-- / Sub Menu -->
      <?php } ?>

    CSS additions:

    /* =Current --------------- */
    .current_page_item a{
    	background: #FFFFFF;
    .current_page_parent a{
    	background: #FFFFFF;}
    .current_page_ancestor a{}

    You likely have your menu’s li displayed as ‘inline’, if not then you’ll want to add that too.

    Here you can find a tutorial regarding displaying dynamic menu pages

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Creating Sub Page Menu’ is closed to new replies.