WordPress.org

Ready to get started?Download WordPress

Forums

Creating secondary and tertiary su menus separate from main menu and dynamically (1 post)

  1. Arathol
    Member
    Posted 1 year ago #

    I need to create 3/4 level split menu.
    The standard wordpress menus nest all the sub pages menus as a ul items within each li item.

    I would like the sub menu to be a separate item in the source and site under the main menu.
    it should basically read in all the sub pages as menu items.

    i also want to create a tertiary menu based on the same principal.

    I found this code on the forum in this post: http://wordpress.org/support/topic/creating-sub-page-menu?replies=5

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

    But this is only for a secondary menu and I cant get it to work for a 3rd or 4th menu (it nests them again within the li's)

    Does anyone know how i can get thsi to work?

Topic Closed

This topic has been closed to new replies.

About this Topic