Menu child items not showing in custom twentyten menu (2 posts)

  1. citydan
    Posted 4 years ago #

    I'm working on a wordpress site that was set up by others. They customized the TwentyTen template to make this site.
    They used a function to automatically create a sidebar navigation menu that includes all pages, in order in the page.php template file:

    <ul class="left-hand-menu left">
          <?php wp_list_pages('title_li=&exclude=29,111,115,771,915,917,919'); ?>

    I'm now creating landing pages and optimizer test pages that I do not want to appear in the navigation. In order to do so I have to find the id number of each new page and add it to the exclusion list in each template file (there's one for the blog as well), which is a pain in the butt. Ideally the site would use the wysiwyg menu editor feature to allow the user to set menus intuitively as needed.
    I have created a new menu in the menu editor and added code to the functions.php file (as per http://www.wpbeginner.com/wp-tutorials/adding-a-second-menu-to-the-twenty-ten-theme/) to make the menu selectable in the menu editor.
    I have added code to page.php to call my secondary menu (as per http://www.wpbeginner.com/wp-themes/how-to-add-custom-navigation-menus-in-wordpress-3-0-themes/)
    --but only the parent menu items appear. I have several levels of child sub-menu items made in the menu editor, but they just don't show up in the site's front-end, not even in the source (they are not just being hidden by CSS).

    How can I make this menu work? Why are the child items not showing up?

  2. citydan
    Posted 4 years ago #

    This is what I've added to my page.php file:
    <?php wp_nav_menu(array('menu_class' => 'left-hand-menu', 'container' => 'false', 'depth' => 0) ); ?>

    I've tried using the 'depth' argument as

    'depth' => 0
    'depth' => '5'
    'depth' => 5

    but in each case, child menus do not appear. This is the output of my menu:

    <ul id="menu-primary-nav-1" class="left-hand-menu"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-4"><a href="http://www.mysite.ca/about-us/">About Us</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-12 current_page_item menu-item-25"><a href="http://www.mysite.ca/solutions/">Products</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-24"><a href="http://www.mysite.ca/heating-cooling-solutions/">Solutions</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27"><a href="http://www.mysite.ca/blog/">Blog</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-28"><a href="http://www.mysite.ca/contact/">Contact Us</a></li>

    There seem to be way more classes than necessary. But where are the child and grandchild menu items?

Topic Closed

This topic has been closed to new replies.

About this Topic