Codepress Menu
[resolved] Level 3 seems to be broken (6 posts)

  1. QuadWord
    Posted 2 years ago #

    wp_nav_menu(array('theme_location' => 'primary',
    'level' => '3',
    'depth' => 1));

    does not show the correct level 3 menu-items of the current level 2 page.

    In a menu structure like:

    • Level_1-Item_1
      • Level_2-Item_1
        • Item_A
      • Level_2-Item_2
      • Level_2-Item_3
        • Item_B
      • Level_2-Item_4

    the result of 'level' => '3','depth' => 1 is always "Item_A" regardless which Level_2 Item/Page is active. Even the Page on Level 1 shows "Item_A".

    do i miss something ?


  2. David Mosterd
    Plugin Author

    Posted 2 years ago #

    Well, I am the author and even I am confused :)

    Sorry for the super-late response.

    I am going to to look into this right now.

  3. David Mosterd
    Plugin Author

    Posted 2 years ago #

    I understand the use-case:

    It is strange that it shows the first level 3 item it can find. From a level 1 perspective all level 3 items should be equal. Just as you expect to show all sub-levels. But asking for a sub-sub level is a different matter.

    The design was to show the children of a current active branch in a sub-location. So, from that perspective it works. But what you want is show all level 3 from the current active branch.

    So, the plugins works correctly and you just introduces a new use-case to me. I could try and think of something in lines of new parameter that ignores sub-sub levels and fetches all requested levels that have a similar ancestor not just the parent.

    For now I am marking this as resolved, but the feature request is noted!

  4. QuadWord
    Posted 2 years ago #

    hi david,

    thanks for your answer.

    my example does not show the result (output) i want but only the underlying menu structure.

    based on this example my usecase would be:
    if i am on the page based on "Level_2-Item_3" then "Item_B" should be the level 3 child of the active branch. but with 'level' => '3','depth' => 1 is does show "Item_A" which is wrong because it is a child of the (inactive) "Level_2-Item_1" branch.

    basically i would expect the same behavior for childrens of level 2 like it resolves childrens of level 1 (which is working fine).

  5. QuadWord
    Posted 2 years ago #

    maybe it is easier to understand if we use more descriptive menu items.
    if the underlying menu looks like this ...

    • apples
      • red
        • half red
        • full red
      • green
        • half green
        • full green
      • yellow
        • half yellow
        • full yellow

    ... and i navigate to "yellow" then the level 3 items of the active branch should be "half yellow" and "full yellow" but it shows only "half red". And if i remember correctly even if you navigate to "red" then the result ist only "half red" and not both "half red" and "full red".

  6. David Mosterd
    Plugin Author

    Posted 2 years ago #

    Ah, like that.

    I am not quite sure though how to handle some stuff here...
    When you are on apples and ask for level 3, what should it show?
    When you are on yellow, I can imagine it should show half yellow and full yellow.

    So maybe only showing 1 level below current level is a manageable/ valid use-case and that is how levels should work: you can request a level, but only if you are one level above it, can it display.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Codepress Menu
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic