cpt()->course()->get_post_type(); if (is_single() && !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] === $course_post_type) { $this->template_id = $this->get_acadlix_single_course_elementor_template_id(); } if (is_post_type_archive(acadlix()->cpt()->course()->get_post_type())) { $this->all_course_template_id = $this->get_acadlix_all_course_elementor_template_id(); } $cpt = acadlix()->cpt(); if ( method_exists($cpt, 'course_bundle') ) { $course_bundle_post_type = $cpt->course_bundle()->get_post_type(); if ( is_single() && !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] === $course_bundle_post_type ) { $this->template_id = $this->get_acadlix_single_course_bundle_elementor_template_id(); } } } public function get_acadlix_single_course_elementor_template_id() { $post_id = null; $template_id = get_option('acadlix_single_course_elementor_template'); if ($template_id) { $post = get_post($template_id); if ( $post && $post->post_type === 'elementor_library' && $post->post_status === 'publish' ) { $post_id = $template_id; } } return $post_id; } public function get_acadlix_all_course_elementor_template_id() { $post_id = null; $template_id = get_option('acadlix_all_course_elementor_template'); if ($template_id) { $post = get_post($template_id); if ( $post && $post->post_type === 'elementor_library' && $post->post_status === 'publish' ) { $post_id = $template_id; } } return $post_id; } public function get_acadlix_single_course_bundle_elementor_template_id() { $post_id = null; $template_id = get_option('acadlix_single_course_bundle_elementor_template'); if ($template_id) { $post = get_post($template_id); if ( $post && $post->post_type === 'elementor_library' && $post->post_status === 'publish' ) { $post_id = $template_id; } } return $post_id; } public function single_course_template($template) { global $wp_query, $post; if (!post_type_supports(acadlix()->cpt()->course()->get_post_type(), 'elementor')) { return $template; } if ($wp_query->is_single && !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] === acadlix()->cpt()->course()->get_post_type()) { $document = Plugin::$instance->documents->get($post->ID); $built_with_elementor = $document && $document->is_built_with_elementor(); $template_id = $this->template_id; if (!$built_with_elementor && !$template_id) { return $template; } $fullwidth = AELMS_PLUGIN_DIR . 'templates/single-course-fullwidth.php'; if (file_exists($fullwidth)) { $template = $fullwidth; } $template_slug = get_page_template_slug($template_id); if ($template_slug === 'elementor_canvas') { $canvas = AELMS_PLUGIN_DIR . 'templates/single-course-canvas.php'; if (file_exists($canvas)) { $template = $canvas; } } return $template; } return $template; } public function all_course_template($template) { if (!is_post_type_archive(acadlix()->cpt()->course()->get_post_type())) { return $template; } if (is_post_type_archive(acadlix()->cpt()->course()->get_post_type())) { $all_course_template_id = $this->all_course_template_id; if (!$all_course_template_id) { return $template; } $fullwidth = AELMS_PLUGIN_DIR . 'templates/all-course-fullwidth.php'; if (file_exists($fullwidth)) { $template = $fullwidth; } $template_slug = get_page_template_slug($all_course_template_id); if ($template_slug === 'elementor_canvas') { $canvas = AELMS_PLUGIN_DIR . 'templates/all-course-canvas.php'; if (file_exists($canvas)) { $template = $canvas; } } return $template; } return $template; } public function single_course_bundle_template($template) { global $wp_query, $post; $cpt = acadlix()->cpt(); if(method_exists($cpt, 'course_bundle')) { $course_bundle_post_type = $cpt->course_bundle()->get_post_type(); } else { return $template; } if (!post_type_supports($course_bundle_post_type, 'elementor')) { return $template; } if ($wp_query->is_single && !empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] === $course_bundle_post_type) { $document = Plugin::$instance->documents->get($post->ID); $built_with_elementor = $document && $document->is_built_with_elementor(); $template_id = $this->template_id; if (!$built_with_elementor && !$template_id) { return $template; } $fullwidth = AELMS_PLUGIN_DIR . 'templates/single-course-bundle-fullwidth.php'; if (file_exists($fullwidth)) { $template = $fullwidth; } $template_slug = get_page_template_slug($template_id); if ($template_slug === 'elementor_canvas') { $canvas = AELMS_PLUGIN_DIR . 'templates/single-course-bundle-canvas.php'; if (file_exists($canvas)) { $template = $canvas; } } return $template; } return $template; } public function single_course_content($post) { $document = Plugin::$instance->documents->get($post->ID); if ($document && $document->is_built_with_elementor()) { // echo Plugin::instance()->frontend->get_builder_content_for_display($post->ID); the_content(); return; } $template_id = $this->template_id; if ($template_id) { echo Plugin::instance()->frontend->get_builder_content_for_display($template_id); return; } the_content(); } public function all_course_content() { $template_id = $this->all_course_template_id; if ($template_id) { $content = Plugin::instance()->frontend->get_builder_content_for_display($template_id); echo wp_kses($content, aelms_allowed_html()); return; } the_content(); } public function single_course_bundle_content($post) { $document = Plugin::$instance->documents->get($post->ID); if ($document && $document->is_built_with_elementor()) { // echo Plugin::instance()->frontend->get_builder_content_for_display($post->ID); the_content(); return; } $template_id = $this->template_id; if ($template_id) { echo Plugin::instance()->frontend->get_builder_content_for_display($template_id); return; } the_content(); } }