I'm trying to make it so that a particular user role is shown a particular menu instead of the standard one on my site.
I want all users to see "Main Menu" as the primary menu. As they do now. But I want "wholesale_customer" to see "Wholesale" menu instead.
Here are the current registered menus
register_nav_menu('primary', __('Primary Menu', 'oxy'));
register_nav_menu('topnavhor', __('Top Horizontal Menu', 'oxy'));
register_nav_menu('topnav', __('Top Dropdown Menu', 'oxy'));
Here is the code I have
// Change main menu for Wholesale Customers
function my_wp_nav_menu_args( $args = ” ) {
if ($args[‘theme_location’] == ‘primary’) {
if( is_user_wholesale_customer()) {
$args[‘menu’] = ‘Wholesale’;
}else{
$args[‘menu’] = ‘Main Menu’;
}
}
return $args;
}
add_filter( ‘wp_nav_menu_args’, ‘my_wp_nav_menu_args’ );
What's wrong with the code as I keep getting a Error 500 when add it to my child theme's functions.php file.