should_load() ) { return; } $this->load_hooks(); } /** * Check if LifterLMS plugin is activated. */ private function should_load() { return class_exists( 'LifterLMS' ); } /** * Load hooks and filters. */ private function load_hooks() { add_action( 'wp_enqueue_scripts', array( $this, 'load_styles' ) ); remove_action( 'lifterlms_before_main_content', 'lifterlms_output_content_wrapper', 10 ); remove_action( 'lifterlms_after_main_content', 'lifterlms_output_content_wrapper_end', 10 ); remove_all_actions( 'lifterlms_sidebar' ); add_action( 'lifterlms_before_main_content', array( $this, 'content_wrapper_open' ), 0 ); add_action( 'lifterlms_after_main_content', array( $this, 'content_wrapper_close' ), PHP_INT_MAX ); add_filter( 'lifterlms_show_page_title', '__return_false' ); add_action( 'neve_llms_content', array( $this, 'content_open' ), 10 ); add_action( 'lifterlms_after_main_content', array( $this, 'content_close' ), 10 ); add_action( 'widgets_init', array( $this, 'register_catalog_sidebar' ) ); add_filter( 'llms_get_theme_default_sidebar', array( $this, 'lms_sidebar' ) ); add_action( 'wp', array( $this, 'load_catalog_sidebar' ) ); add_filter( 'llms_checkout_error_output', array( $this, 'checkout_error_entry_content_close' ) ); } /** * Enqueue styles. */ public function load_styles() { wp_enqueue_style( 'neve-lifter', NEVE_ASSETS_URL . 'css/lifter' . ( ( NEVE_DEBUG ) ? '' : '.min' ) . '.css', array(), apply_filters( 'neve_version_filter', NEVE_VERSION ) ); } /** * Load Sidebar */ public function load_catalog_sidebar() { $sidebar_position = get_theme_mod( 'neve_default_sidebar_layout', 'right' ); if ( $sidebar_position === 'right' ) { add_action( 'lifterlms_after_main_content', array( $this, 'render_catalog_sidebar' ), 11 ); } if ( $sidebar_position === 'left' ) { add_action( 'neve_llms_content', array( $this, 'render_catalog_sidebar' ), 1 ); } } /** * Display LifterLMS Course and Lesson sidebars * on courses and lessons in place of the sidebar returned by * this function * * @return string */ public function lms_sidebar() { return 'blog-sidebar'; } /** * Add markup before main content. */ public function content_wrapper_open() { $container_class = apply_filters( 'neve_container_class_filter', 'container' ); echo '
'; echo '
'; do_action( 'neve_llms_content' ); } /** * Close Content Wrapper */ public function content_wrapper_close() { echo '
'; // .row close echo '
'; // .lms-container close } /** * Add markup for LifterLms title and open content wrap div */ public function content_open() { echo '
'; echo '
'; echo '
'; echo '

'; lifterlms_page_title(); echo '

'; echo '
'; echo '
'; echo '
'; } /** * Close content. */ public function content_close() { echo '
'; // .nv-content-wrap .entry-content close echo '
'; // .nv-single-page-wrap .col close } /** * Register LifterLMS Catalog Sidebar. */ public function register_catalog_sidebar() { register_sidebar( array( 'name' => __( 'Catalog Sidebar', 'neve' ), 'id' => 'llms_shop', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } /** * Sidebar Markup Wrapper open. */ public function render_catalog_sidebar() { if ( ! is_active_sidebar( 'llms_shop' ) ) { return; } $sidebar_position = get_theme_mod( 'neve_default_sidebar_layout', 'right' ); echo '
'; dynamic_sidebar( 'llms_shop' ); echo '
'; } /** * Close entry content div on error. * * @param string $error Error text. * * @return string */ public function checkout_error_entry_content_close( $error ) { return $error . ''; } }