WordPress.org

Ready to get started?Download WordPress

Forums

wp_nav_menu not displaying subcategories? (5 posts)

  1. alsd
    Member
    Posted 3 years ago #

    Maybe I am not fully understand how wp_nav_menu works. I thought if I add a parent category which has a number of subcategories I will be getting this:

    • Parent menu
      • Sub menu 1
      • Sub menu 2

    instead of

    • Parent menu
    • Sub menu 1
    • Sub menu 2

    I tried adding "depth" parameter:
    <?php wp_nav_menu( array( 'container_id' => 'quick-access', 'theme_location' => 'primary', 'depth' => 2, ) ); ?>

    Still I am not seeing a hierarchy. ?!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    There is no hierarchy with custom menus. And there's no depth parameter for wp_nav_menu, either.

    http://codex.wordpress.org/Function_Reference/wp_nav_menu

  3. alsd
    Member
    Posted 3 years ago #

    Hmmm, I saw this in the Default Usage:

    'depth' => 0,

    and quote Justin Tadlock (found the reference link in the codex link you provided):
    depth: How many levels the menu should display, which is useful for things like drop-down menus. This is set to 0 (any level) by default.

  4. alsd
    Member
    Posted 3 years ago #

    OK, I found the problem. It does work.

    Once the menu added to menu area, you need to drag the menu bar, up/down for horizontal position, left/right for hierarchy. "'depth' => 2" prevent user to use the 3rd level.

  5. vaseemansari
    Member
    Posted 3 years ago #

    Hello Dear

    i have a query and i know that you know the answer of this
    i am using wp nav menu to show 6 navigation menu in header here
    http://showprojects.net/projects/csrc/

    Now i want when user clicks on any item(post,page,category,tag) in sub menu then the left sidebar will show all the submenus of that parent.

    My question is similar to this thread
    http://wordpress.stackexchange.com/questions/2802/display-a-only-a-portion-of-the-menu-tree-using-wp-nav-menu

    Explaination
    Root Menu
    Sub menu 1
    Sub menu 2 (clicked)

    My sidebar will show only child sub menus of clicked root menu
    Sub menu 1
    Sub menu 2 (clicked)

    Waiting for your answer.
    Thanks
    Vaseem Ansari
    http://www.vaseemansari.com/blog/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.