Secondary Menu based on current page

I have two levels of menu items. The first is Cars, like “toyota” and “Lexus.” the second level has pages that relate to each. So its Fuel, Price, and Safety. Each of the child pages will be unique for each Car, but the name swill be the same.

What I am trying to do is when the user clicks on “Toyota,” the icons Fuel, Price, and Safety link to the appropriate child-page for the parent-page (toyota).

this is the code for my secondary menu:

function secondary_menu() {
if ( has_nav_menu( ‘secondary-menu’ ) ) { // only show if the location secondary-menu has a menu assigned
echo beans_open_markup( ‘secondary_menu_nav’, ‘div’, ‘class=secondary-menu’ );
wp_nav_menu( array(
‘menu’ => ‘Secondary’,
‘menu_class’ => ‘uk-navbar-nav uk-visible-larget’,
‘container’ => ‘nav’,
‘container_class’ => ‘uk-container uk-container-center uk-navbar’,
‘theme_location’ => ‘secondary-menu’,
‘beans_type’ => ‘navbar’
) );

the links on the secondary link should dynamically conform to the current page, so I can use the same menu names/icons (Fuel,etc) but dyanimcally change the target URL to the appropriate child-page.

Is this a case for a walker class?

Read more here:: Secondary Menu based on current page

Leave a Reply

Your email address will not be published. Required fields are marked *