WordPress.org

Ready to get started?Download WordPress

Forums

Get a part of a navigation menu (2 posts)

  1. michael.mariart
    Member
    Posted 3 years ago #

    Hi all.

    I'm trying to figure out how I can get a sub-menu part of a main navigation menu, and from what I've found in the wordpress docs, there doesn't seem to be a built-in way to do it.

    I have thought that the most logical function to use is wp_nav_menu() and that lets me pass how many levels I want to display, but it doesn't let me specify a starting node/level.

    As an example, say I have a menu structure like this:

    Page 1
      Page 1.1
      Page 1.2
    Page 2
      Page 2.1
      Page 2.2
        Page 2.2.1
        Page 2.2.2
        Page 2.2.3
      Page 2.3

    What I want to do is be able to start the menu at 'Page 2.2' and display the sub-pages from there. So, the menu that I'm trying to end up with would be:

    Page 2.2
      Page 2.2.1
      Page 2.2.2
      Page 2.2.3

    Is there any "easy" built-in way to get a menu structure like this,or do I need to write all of my own functions to achieve this?

  2. michael.mariart
    Member
    Posted 3 years ago #

    Looking around, there doesn't seem to be any sort of functionality available to do this at all.

    The best "solution" that I can find so far is to use CSS to "display: none;" the menu items that I don't want to show.

    This does work, but seriously... Is this the best option that is available? I am worried that using this method has a chance (however small) of getting dropped from search engines because I'm hiding/cloaking links, and that does make me a bit nervous.

    Open to any other suggestions or advice here!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.