Archived topic
swap navigation menu through a hook
2 replies · Started by Ash on July 19, 2017
Viewing posts 1–3 of 3
How do I swap menu through a hook conditionally?
I have to swap depend on cookie so plugins out there can't handle.
I've done with another theme but this don't work with GP.
function my_wp_nav_menu_args($args=''){
if(!empty($_COOKIE['translator-translator-jquery-to']) && $args['theme_location']=='primary'){
$args['menu']='MAIN2';
}
return $args;
}
add_filter('wp_nav_menu_args','my_wp_nav_menu_args');
I think it still works with GP.
Might be because of cache or hook priority...
Yep, that should work regardless of which theme you use :)
This archived topic is closed to new replies.