This quick guide by ThimPress will show you how to easily hide WordPress toolbar from users so that only instructors see the toolbar, providing a cleaner experience for students.
Install Child Theme
Install Child Theme:
- Go to your WordPress Dashboard.
- Navigate to Course Builder.
- Select Child Themes.
- Follow the on-screen instructions to install your chosen child theme.
Why a Child Theme? Using a child theme is crucial for safe customization. It inherits the appearance and functions of the parent (Course Builder) theme but allows you to make changes without directly editing the plugin’s original files. This way, your modifications won’t be overwritten when the plugin is updated.
Custom functions.php file
In the functions.php file of the child theme, put the following code:
$user = wp_get_current_user();
if ( in_array( 'instructor', (array) $user->roles ) ) {
} elseif ( in_array( 'administrator', (array) $user->roles )) {
show_admin_bar(true);
}elseif ( in_array( 'lp_teacher', (array) $user->roles )) {
show_admin_bar(true);
} else {
show_admin_bar(false);
}
When finished, save the functions.php file. Now your site has hidden the WordPress toolbar from users except for Admin and Instructor.
Learn More from ThimPress Knowledge Base Articles:
- Set Up Redirect when clicking the Check Availability button
- Translate Rooms in Multilingual with WPML
- LearnPress Translation Using The Loco Translate Plugin
- LearnPress: List of Some Issues and Best Ways to Fix Them
- Schedule Your Auto Posting Pipes with Cron Job
- WP Pipes System Requirements
- How to Use Custom CSS in Your Online Course
- Create a Child Theme in Resca: A Step-by-Step Guide
- One-Click Resca Theme Installation Guide (Video)
- Step-by-Step Video Tutorial: Installing Resca Theme
Contact US | ThimPress:
Website: https://thimpress.com/
Fanpage: https://www.facebook.com/ThimPress
YouTube: https://www.youtube.com/c/ThimPressDesign
Twitter (X): https://twitter.com/thimpress