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' ); /** * 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' ); } } endif; add_action( 'wp_enqueue_scripts', 'course_scripts' ); function course_theme_init() { register_block_style( 'core/navigation-link', array( 'name' => 'navigation-link-button', 'label' => __( 'Button', 'course' ), ) ); } add_action( 'init', 'course_theme_init' ); /** * Register Sensei LMS block patterns category. */ function course_register_block_patterns_category() { register_block_pattern_category( 'sensei-lms', [ 'label' => 'Sensei LMS' ] ); } add_action( 'init', 'course_register_block_patterns_category' ); add_filter( 'theme_lesson_templates', 'course_theme_filter_single_lesson_template_for_sensei_learning_mode', 11, 3 ); /** * Filter the list of templates for the single lesson page. * * @param array $page_templates Array of page templates. * @param string $theme The current theme. * @param WP_Post $post The post being edited, provided for context, or null. * * @since Course 1.3.2 * * @return array Array of page templates. */ function course_theme_filter_single_lesson_template_for_sensei_learning_mode( $page_templates, $theme, $post ) { // In case some other plugin has a post type called lesson. if ( ! $post || ! class_exists( 'Sensei_Main' ) ) { return $page_templates; } $course_id = Sensei()->lesson->get_course_id( $post->ID ); $is_learning_mode_enabled = Sensei_Course_Theme_Option::has_learning_mode_enabled( $course_id ); if ( $is_learning_mode_enabled ) { unset( $page_templates['single-lesson'] ); } return $page_templates; }