Hi,
That’s an interesting idea, but it’s not a feature that I am looking to add right now. You can always add that kind of conditional logic into your header.php file.
Cheers,
-kathy
Hi Cathy,
Thanks a lot for this suggestion. Do you have a code that I could use in the header or as a function?
Thanks a lot.
Assuming your logic is based on WP user roles/capabilities you’d use current_user_can() and replace your generic menu call, ex:
wp_nav_menu('primary');
with something like:
if ( current_user_can( 'manage_options' ) ) {
wp_nav_menu('primary-admin');
} else {
wp_nav_menu('primary');
}
where users who can manage options are generally Admins. You can use roles in current_user_can($role) as that’s what I use in NMR because it’s easier to read, but technically it’s more precise to use capabilities.
Also this assumes that you have two menus locations registered, primary-admin a menu for admins only and primary your regular menu.
I hope that helps.
Thanks a lot Cathy, this should help a lot, although I intend to use it based on roles, for example student role will see student-menu only, teacher role will see teacher-menu only, while parent role will see parent-menu and so on.
I will try to make changes and try the code in the next few days.
Thanks a lot for your continuous help.