Introduction
In LifterLMS, the Lessons List sidebar is visible to all users by default. If you want to hide this sidebar for all users except administrators, you can achieve this by adding a small custom function to your active theme. This guide explains how to hide the LifterLMS Lessons List sidebar for all users to create a cleaner course layout.
Custom Workaround
- Go to Appearance > Theme Editor in your WordPress admin dashboard.
- Under Select theme to edit, choose your active theme (preferably a BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
- Click Update File to save the changes.
Troubleshooting and FAQs
Q: The sidebar is still visible to non-admin users.
A: Make sure jQuery is loaded on the page. Also, double-check that the code is added to the active theme’s functions.php file.
Q: Can I hide the sidebar for specific user roles instead of all non-admins?
A: Yes. Replace current_user_can( ‘administrator’ ) with another capability check, e.g., current_user_can( ‘editor’ ).
Q: Will this affect mobile or responsive views?
A: The script hides the sidebar using jQuery, which applies to all views including mobile.
Q: Can this be undone?
A: Yes. Remove the code from functions.php and save the file.