Different header AND footer menus for the shop area

Hello,

I tried my best without asking for support but can’t achieve any further progress.

I would like to have a somewhat separated shop area.
It should have a different header AND footer menu as the main part of the website.

With some research and the help of your forum I was able to establish a different menu for the shop area with this code:
add_filter( ‘wp_nav_menu_args’, ‘custom_blog_menu’ );

function custom_blog_menu( $args ) {
if ( x_is_product() || x_is_product_index() || is_page(620) || is_page(576)) {
$args[‘theme_location’] = ‘primary’;
$args[‘menu’] = ‘Shop Menü’;
}
return $args;
}

My problem now is that this creates a footer menu wich is exactly the same as the header menu. I would need different one.
Because it is a bit confusing: I am looking for 4 different menus. Till now I only made it to 3.

If you could help me with you would make me very happy! Thank you!

Hello Vin,

Thanks for writing in!

This code will only replace the assigned primary menu with “Shop Menu” when the conditions is true:

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( x_is_product() || x_is_product_index() || is_page(620) || is_page(576)) {
$args['theme_location'] = 'primary';
$args['menu'] = 'Shop Menü';
}
return $args;
}

This code does not change the footer menu as well. If you have imported a demo content, most probably, the demo menu is used for your primary or footer menu. You will have to add another menu for the footer and modify the code above into something like this:

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
	if ( x_is_product() || x_is_product_index() || is_page(620) || is_page(576)) {
		$args['theme_location'] = 'primary';
		$args['menu'] = 'Shop Menu';
	}

	if ( x_is_product() || x_is_product_index() || is_page(620) || is_page(576)) {
		$args['theme_location'] = 'footer';
		$args['menu'] = 'Your Footer Menu';
	}

	return $args;
}

Just make sure to insert the correct menu names.

Thank you once again!

I copied the new code and inserted the correct menu names but now it shows what only should be the footer menu in the footer AND the primary. Means still only three different menus. It is just the other way around and the primary is missing now.

Looking forward to new ideas.

Best regards,
Vin

Hello Vin,

The given code will swap out the menu for the header and the footer as long as the conditions are met. Do you want to display additional menu instead? That might not be possible.

To better assist you, please provide us access to your site so we can take a closer look at your settings and menus.

Thanks.

Hello,

thank you RueNel!

As there is some room for misunderstandings I try to explain it a little better.
My site should be somewhat separated. So you can think of two parts: The main one and the shop area.
In the main part I would like to have a primary menu and a different footer menu - so ordinary standard till here.
The new added shop area should get it’s own primary and footer menus.
The different menus of the main part should get swapped when entering the shop area and the other way around.
So all you can see at one point is one primary and one different footer menu. Like it would be with another domain for the shop area with ordinary menus as well.
That’s what I meant with 4 different menus:
1x primary menu main area
1x footer menu main area
1x primary menu shop area
1x footer menu shop area
But till now I only managed to get only three different menus ( I can only choose one for the whole shop area).

The code I copied from the forum beforehand (see below) worked great in terms of providing me with a different menu in the shop area. But now both the primary and the footer menu are showing what should only be the primary menu of the shop area.
So my initual question was: How can I get another menu in the footer as well?

The code you provided (see below) let me change the footer menu but it also changes the primary menu. So right now I have two times the footer menu in the shop area. It is somewhat the other way around.

To sum it up both codes work in terms of providing different menus for the shop area. But both fail to give me a primary menu which is different from the footer. If I choose the first code I only get what should only be the primary for the footer as well. And if I choose the second code I get what should only be the footer menu as the primary as well.

Thank you for your patience. I hope this explains it more clear.

Best regards,
Vin

Hey Vin,

I’m sorry but this would require customization work which is outside the scope of our support. I would recommend that you convert your WordPress install to Multisite so you could power your shop separately with different menus. Or, upgrade to Pro for easy assignment of custom headers to specific pages including the shop page.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.