Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1233577
    cloudtribal
    Participant

    Hi,

    Not a pro in PHP or WP API, but I have very simple code in functions.php that switches menus if user is logged in.

    
    function switch_menus( $args = '' ) {
    
    if( is_user_logged_in() ) {
        $args['menu'] = 'loggedin';
    } else {
        $args['menu'] = 'loggedout';
    } 
        return $args;
    }
    add_filter( 'wp_nav_menu_args', 'switch_menus' );

    However that switches the menu for the footer as well, so I guess ['menu'] is a general parameter for all menus.

    What is the parameter specifically for the main menu, in X?

    #1233794
    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Please refer to the following example (https://community.theme.co/forums/topic/changing-menus-for-logged-in-users/).

    Hope that helps.

    #1237351
    cloudtribal
    Participant

    Thx 1M

    #1237416
    Rupok
    Member

    You are welcome!

  • <script> jQuery(function($){ $("#no-reply-1233577 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>