• I have a site set up where I am using the Advanced Custom Field nav menu which is pulling in a menu and I can select which menu is on the page. The problem I am having is I don’t want to show the entire (100+) pages that are in the menu but only the child pages of the page that I am currently on.

    dev.ussailing.org/index.php/education

    On that page I have a child page navigation plugin in use and below that is the menu I am trying to work with…The reason I am trying to do this is basically because I have pages that I want to be on multiple pages in their navigation and wordpress only lets you set one parent page in the page tree.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unfamiliar with those plugins, but the following will work any place wp_nav_menu() is used to display a menu. All the default twenty* themes and many more use this function.

    You can use the ‘wp_nav_menu_objects’ filter to alter which menu items occur by adding and removing menu items from the passed ordered list.

    You can alternately add a ‘walker’ parameter to the wp_nav_menu() function call, passing a custom walker object which builds the HTML menu item list. This gives you complete control over the appearance of the menu items and the choice to output any item at all, or not. See Custom Walker Function.

    There are also several other filters you could hook into at various stages of building a menu. Review the source code to see what’s available when. The source is also the best way to understand how data is passed and the return used for the ‘wp_nav_menu_objects’ filter, as well as for the walker object called by walk_nav_menu_tree() from within wp_nav_menu().

Viewing 1 replies (of 1 total)
  • The topic ‘Display Menu only if Current Page is in Menu’ is closed to new replies.