Pet Rescue Theme Course and Lesson Sidebar Compatibility
As of March 2017, the recommend method for sidebar compatibility is to use LifterLMS Labs: Super Sidebars, a free add-on that allows you to add sidebar compatibility to just about any theme in a matter of seconds without having to write any code. See the full tutorial here.
If you’re using the Pet Rescue theme you’ll want to add the following snippet to your theme or child theme’s functions.php file in order to ensure LifterLMS Course and Lesson sidebars function correctly.
// Don't copy this line! /** * LifterLMS Course and Lesson Sidebar compatibility for the Pet Rescue theme (http://themeforest.net/item/pet-rescue-animals-shelter-charity-wp-theme/9347370?ref=gocodeBOX) * * @since 2016-04-22 */ /** * Display lesson and course custom sidebars on the appropriate LifterLMS pages * * @param array $sidebars_widgets array of registered sidebars * @return array */ function lifterlms_sidebar_compatibility( $sidebars_widgets ) { // replace the widgets in the primary sidebar with LifterLMS Course sidebar on Course Pages if ( is_singular( 'course' ) && array_key_exists( 'llms_course_widgets_side', $sidebars_widgets ) ) { $sidebars_widgets['sidebar_default'] = $sidebars_widgets['llms_course_widgets_side']; } // replace the widgets in the primary sidebar with LifterLMS Lesson sidebar on Lesson Pages elseif ( is_singular( 'lesson' ) && array_key_exists( 'llms_lesson_widgets_side', $sidebars_widgets ) ) { $sidebars_widgets['sidebar_default'] = $sidebars_widgets['llms_lesson_widgets_side']; } return $sidebars_widgets; } add_filter( 'sidebars_widgets', 'lifterlms_sidebar_compatibility' );