[Resolved] Most GP-friendly way to modify primary menu

Home Forums Support Most GP-friendly way to modify primary menu

  • This topic has 3 replies, 2 voices, and was last updated 4 months ago by Leo.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1452807
    Bret

    I’ve got a customer requirement that says display a different menu if a user is logged in.

    In some themes, there’s a navigation snippet that can be copied into the child theme.

       if (is_home()) {
            wp_nav_menu( array(
                    'theme_location' => 'header-menu',
                    'menu'           => 'blog-menu',
                    'container'              => false,
                    'fallback_cb'    => '',
                    'menu_class'     => 'primary-menu bb-primary-overflow', )
            );
    
       } else {
            wp_nav_menu( array(
                    'theme_location' => 'header-menu',
                    'menu_id'                => 'primary-menu',
                    'container'              => false,
                    'fallback_cb'    => '',
                    'menu_class'     => 'primary-menu bb-primary-overflow', )
            );
       }
    

    In GP, this is all in the navigation.php, which is ~400 lines of code and I don’t think I really want it in my child theme.

    Is there a GP-friendly way to accomplish this?

    Hacky ideas include generating all possible menu sites, and then using conditional javascript to hide them.

    #1452841
    Leo
    Staff
    Customer Support

    Hi there,

    Would use a plugin like this simplify things a bit?
    https://en-ca.wordpress.org/plugins/if-menu/

    #1454115
    Bret

    OK will give it a try!

    #1454179
    Leo
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.