Archived topic
Slide-out menu icon visibility
3 replies · Started by Frank on July 3, 2017
Greetings good folks,
I want to use the slideout menu for collaborators only. This makes it easy for me to work on pages without them being visible to the general public.
So, could you write me a little PHP snippet like you did for the shopping cart?
I want the hamburger menu icon (slideout menu trigger) to be visible only to logged-in users of WP role "collaborator".
THX so much in advance.
Same sort of thing:
add_action( 'after_setup_theme', 'tu_slideout_icon_collab' );
function tu_slideout_icon_collab() {
remove_filter( 'wp_nav_menu_items','generate_menu_plus_slidebar_icon', 10, 2 );
if ( current_user_can( 'contributor' ) ) {
add_filter( 'wp_nav_menu_items','generate_menu_plus_slidebar_icon', 10, 2 );
}
}
I put contributor as collaborator isn't a role: https://codex.wordpress.org/Roles_and_Capabilities
THX a lot!
Sure did the trick.
You're welcome :)