[Resolved] secondary navigation copies items of primary navigation

Home Forums Support [Resolved] secondary navigation copies items of primary navigation

Home Forums Support secondary navigation copies items of primary navigation

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #451025
    Kaleem

    hello sir, my secondary navigation shows the same items of primary navigation.
    i want to insert different items to the secondary navigation, but both share the same items.
    hope you can help me solve it. thank you.

    #451097
    Leo
    Staff
    Customer Support

    Hi there,

    You need to create two separate menus for each navigation: https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#setting-a-theme-location

    #452352
    Kaleem

    The problem was a php code added to my child.
    I added the code just to show different menu to logged-in/logged-out users. i really need that function, but im not good at php at all.
    Sir, can you please fiddle the code to fit with both the primary and the secondary menu? I want both the primary and the secondary be shown to a logged-in user while a different menu shown to a logged-out user. here is the code:

    function my_wp_nav_menu_args( $args = ” ) {
    if( is_user_logged_in() ) {
    $args[‘menu’] = ‘logged-in’;
    } else {
    $args[‘menu’] = ‘logged-out’;
    }
    return $args;
    }
    add_filter( ‘wp_nav_menu_args’, ‘my_wp_nav_menu_args’ );

    Thank you in advance.

    #452598
    Tom
    Lead Developer
    Lead Developer

    Perhaps it would be better to use a plugin like this?: https://en-ca.wordpress.org/plugins/nav-menu-roles/

    #453055
    Kaleem

    Nice one. Thank you for the help.

    #453177
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

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