Site logo

Archived topic

secondary navigation copies items of primary navigation

5 replies · Started by Kaleem on December 16, 2017

Viewing posts 1–6 of 6

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.

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.

Nice one. Thank you for the help.

You're welcome :)

This archived topic is closed to new replies.