How do I remove the Secondary Sidebar on Course or Lesson pages when using Genesis?
If you’re using Genesis or a Genesis Child Theme which uses the Secondary (or alternate) sidebar but you don’t want that sidebar displaying on LifterLMS course and or lesson pages, simply paste the following snippet(s) into your functions.php file to remove the alternate sidebar when users are viewing the content type(s).
On a Course
// Don't copy this line! /** * Remove Genesis Alternate Sidebar from LifterLMS Course Page * * @since 2016-04-04 */ /** * Deregister Genesis sidebar(s) on LifterLMS Course page */ function maybe_deregister_sidebars() { if ( 'course' === get_post_type() ) { remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' ); } } add_action( 'wp', 'maybe_deregister_sidebars', 777 );
On a Lesson
// Don't copy this line! /** * Remove Genesis Alternate Sidebar from LifterLMS Course Page * * @since 2016-04-04 */ /** * Deregister Genesis sidebar(s) on LifterLMS Course page */ function maybe_deregister_sidebars() { if ( 'course' === get_post_type() ) { remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' ); } } add_action( 'wp', 'maybe_deregister_sidebars', 777 );