ASTRA_Ext_LifterLMS_Markup::llms_learning()

Distraction Free for LLMS Course/Lession Page.


Description


Return

(void)


Source

File: addons/lifterlms/classes/class-astra-ext-lifterlms-markup.php

		public function llms_learning() {

			if ( is_lesson() || is_course() ) {

				remove_action( 'lifterlms_single_course_before_summary', 'lifterlms_template_single_featured_image', 10 );
				remove_action( 'lifterlms_single_course_before_summary', 'lifterlms_template_single_video', 20 );
				remove_action( 'lifterlms_single_course_before_summary', 'lifterlms_template_single_audio', 30 );

				$page_restricted = llms_page_restricted( get_the_id() );
				$featured_img    = true;
				$description     = true;
				$meta            = true;
				$instructor      = true;
				$syllabus        = true;
				$progress_bar    = true;

				if ( $page_restricted['is_restricted'] ) {

					$featured_img = astra_get_option( 'lifterlms-enable-visitor-featured-image' );
					$description  = astra_get_option( 'lifterlms-enable-visitor-course-description' );
					$meta         = astra_get_option( 'lifterlms-enable-visitor-course-meta' );
					$instructor   = astra_get_option( 'lifterlms-enable-visitor-instructor-detail' );
					$syllabus     = astra_get_option( 'lifterlms-enable-visitor-syllabus' );
				} else {

					if ( astra_get_option( 'lifterlms-distraction-free-learning' ) ) {

						// HFB Support for distration free checkout.
						if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) {
							remove_action( 'astra_header', array( Astra_Builder_Header::get_instance(), 'prepare_header_builder_markup' ) );
							remove_action( 'astra_footer', array( Astra_Builder_Footer::get_instance(), 'footer_markup' ), 10 );
						}

						remove_action( 'astra_header', 'astra_header_markup' );
						remove_action( 'astra_footer', 'astra_footer_markup' );

						add_action( 'astra_header', array( $this, 'header_markup' ) );
						add_action( 'astra_footer', array( $this, 'footer_markup' ) );
					}

					$featured_img = astra_get_option( 'lifterlms-enable-featured-image' );
					$description  = astra_get_option( 'lifterlms-enable-course-description' );
					$meta         = astra_get_option( 'lifterlms-enable-course-meta' );
					$instructor   = astra_get_option( 'lifterlms-enable-instructor-detail' );
					$progress_bar = astra_get_option( 'lifterlms-enable-progress-bar' );
				}

				if ( ! $featured_img ) {
					add_filter( 'astra_get_option_blog-single-post-structure', array( $this, 'disable_featured_img' ) );
				}

				if ( ! $meta || ! $instructor ) {
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_meta_wrapper_start', 5 );
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_meta_wrapper_end', 50 );
				}

				if ( ! $instructor ) {
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_course_author', 40 );
				}

				if ( ! $progress_bar ) {
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_progress', 60 );
				}

				if ( ! $syllabus ) {
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_syllabus', 90 );
				}

				if ( ! $meta ) {
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_length', 10 );
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_difficulty', 20 );
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_tracks', 25 );
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_categories', 30 );
					remove_action( 'lifterlms_single_course_after_summary', 'lifterlms_template_single_course_tags', 35 );
				}

				if ( is_course() && ! $description ) {
					add_filter( 'the_excerpt', '__return_empty_string', 9 );
					add_filter( 'the_content', '__return_empty_string', 9 );
				}
			}
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.