• Hello. I have recently changed the default “minimal” header menu of my website for a custom header I created in “Theme Panel”. I used to have a working code I added to my child theme′s function.php for changing the main menu depending on whether the user was logged in or logged out. The code I used was the following:

    function wpc_wp_nav_menu_args( $args = ” ) {
    if( is_user_logged_in()) {
    if( ‘main_menu’ == $args[‘theme_location’] ) { // Change top-navigation to theme specific name
    $args[‘menu’] = ‘Menu Principal (Logged in)’;
    }
    } else {
    if( ‘main_menu’ == $args[‘theme_location’] ) { // Change top-navigation to theme specific name
    $args[‘menu’] = ‘Menu Principal (Logged out)’;
    }
    }
    return $args;
    }
    add_filter( ‘wp_nav_menu_args’, ‘wpc_wp_nav_menu_args’ );

    I would like to know how could I implement the same function, but with my custom header instead of the default “minimal” header. P.D I have created two different headers with elementor (Custom Header Logged in and Custom Header Logged out), each including its respective main menu.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Logged in and Logged out Custom Headers’ is closed to new replies.