diff --git a/course/functions.php b/course/functions.php index 0589ff48af..643800b02e 100644 --- a/course/functions.php +++ b/course/functions.php @@ -20,7 +20,6 @@ * @return void */ function course_support() { - add_theme_support( 'sensei-learning-mode' ); // Enqueue editor styles. @@ -32,7 +31,7 @@ function course_support() { add_action( 'after_setup_theme', 'course_support' ); -if (!function_exists( 'course_scripts' )) : +if ( ! function_exists( 'course_scripts' ) ) : /** * Enqueue scripts and styles. @@ -42,33 +41,22 @@ function course_support() { * @return void */ function course_scripts() { - - // Register theme stylesheet. - wp_register_style( - 'course-style', - get_stylesheet_directory_uri() . '/style.css', - array(), - wp_get_theme()->get( 'Version' ) - ); - - wp_register_style( - 'course-sensei-learning-mode', - get_stylesheet_directory_uri() . '/learning-mode.css', - array(), - wp_get_theme()->get( - 'Version' - ) - ); - - // Enqueue theme stylesheet. + wp_register_style( 'course-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); + wp_enqueue_script( 'course-header', get_template_directory_uri() . '/assets/js/header.js', [], wp_get_theme()->get( 'Version' ), true ); wp_enqueue_style( 'course-style' ); - // TODO: Only Load it if the the page is using learning mode - wp_enqueue_style( 'course-sensei-learning-mode' ); + /** + * Temporary Hook to skip the learning mode style when the Sensei LMS is able to provide it. + * It is only used to continue loading the deprecated styles if a old sensei version is installed. + */ + $use_deprecated_style = apply_filters( 'course_learning_mode_load_styles', true ); + + if ( class_exists( 'Sensei_Main' ) && $use_deprecated_style ) { + wp_register_style( 'course-sensei-learning-mode', get_stylesheet_directory_uri() . '/learning-mode.css', array(), wp_get_theme()->get( 'Version' ) ); + wp_enqueue_style( 'course-sensei-learning-mode' ); + } - // Enqueque theme scripts. - wp_enqueue_script( 'course-header', get_template_directory_uri() . '/assets/js/header.js', [], wp_get_theme()->get( 'Version' ), true ); - } + } endif; @@ -99,7 +87,6 @@ function course_register_block_patterns_category() { } add_action( 'init', 'course_register_block_patterns_category' ); - /** * Determine the theme variation and save in option. * diff --git a/course/learning-mode.css b/course/learning-mode.css index 4efd21ae85..790ceb9026 100644 --- a/course/learning-mode.css +++ b/course/learning-mode.css @@ -1,3 +1,8 @@ +/** +### DEPRECATED FILE ### +Please don't update it, this file will be moved to the Sensei plugin to better Maintainability. + +**/ :root, .sensei-course-theme { --sensei-lm-header-height: 116px; }