[Resolved] swap navigation menu through a hook

Home Forums Support swap navigation menu through a hook

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #351929
    Ash

    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');
    GeneratePress 1.3.48
    GP Premium 1.3.1
    #351951
    Ash

    I think it still works with GP.
    Might be because of cache or hook priority…

    #352054
    Tom
    Lead Developer
    Lead Developer

    Yep, that should work regardless of which theme you use 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.