diff --git a/includes/classes/Template.php b/includes/classes/Template.php index aaf1cd0..138f3c8 100644 --- a/includes/classes/Template.php +++ b/includes/classes/Template.php @@ -33,8 +33,7 @@ public function single_course_template( $template ) { return $template; } - if ( $wp_query->is_single && ! empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] === tutor()->course_post_type ) { - + if ( is_single() && ! tutor_utils()->is_learning_area() && get_query_var( 'post_type' ) === tutor()->course_post_type ) { $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); if ( $is_page_builder_used ) { diff --git a/includes/modules/CourseAuthor/CourseAuthor.jsx b/includes/modules/CourseAuthor/CourseAuthor.jsx index 2c3a47e..53a6e43 100644 --- a/includes/modules/CourseAuthor/CourseAuthor.jsx +++ b/includes/modules/CourseAuthor/CourseAuthor.jsx @@ -13,6 +13,7 @@ class CourseAuthor extends Component { static css(props) { const additionalCss = []; const wrapper = "%%order_class%% .tutor-single-course-author-meta"; + const course_author_wrapper = ".tutor_course_author_0"; const img_selector = "%%order_class%% .tutor-avatar, %%order_class%% .tutor-avatar img"; //const label_selector = '%%order_class%% .tutor-single-course-author-name > span'; @@ -214,6 +215,16 @@ class CourseAuthor extends Component { ]); } + + if ( props.__author == null ) { + additionalCss.push([ + { + selector: course_author_wrapper, + declaration: `display: none !important` + } + ]); + } + return additionalCss; } diff --git a/includes/modules/CourseAuthor/CourseAuthor.php b/includes/modules/CourseAuthor/CourseAuthor.php index 79d3fcd..30c4e39 100644 --- a/includes/modules/CourseAuthor/CourseAuthor.php +++ b/includes/modules/CourseAuthor/CourseAuthor.php @@ -316,8 +316,9 @@ public static function get_content( $args = array() ) { */ public function render( $attrs, $content, $render_slug ) { // selectors - $wrapper = '%%order_class%% .tutor-single-course-author-meta'; - $img_selector = '%%order_class%% .tutor-avatar, %%order_class%% .tutor-avatar img'; + $wrapper = '%%order_class%% .tutor-single-course-author-meta'; + $course_author_wrapper = '.tutor_course_author_0'; + $img_selector = '%%order_class%% .tutor-avatar, %%order_class%% .tutor-avatar img'; // props $display = 'flex'; @@ -590,6 +591,16 @@ public function render( $attrs, $content, $render_slug ) { $output = self::get_content( $this->props ); + if ( '' === $output ) { + ET_Builder_Element::set_style( + $render_slug, + array( + 'selector' => $course_author_wrapper, + 'declaration' => 'display: none !important', + ) + ); + } + // Render empty string if no output is generated to avoid unwanted vertical space. if ( '' === $output ) { return ''; diff --git a/includes/modules/CourseCategories/CourseCategories.php b/includes/modules/CourseCategories/CourseCategories.php index 50efd18..7836b36 100644 --- a/includes/modules/CourseCategories/CourseCategories.php +++ b/includes/modules/CourseCategories/CourseCategories.php @@ -119,7 +119,7 @@ public function get_fields() { 'type' => 'text', 'option_category' => 'layout', 'default' => esc_html__( 'Categories:', 'tutor-lms-divi-modules' ), - 'toggle_slug' => 'main_content', + 'toggle_slug' => 'main_content', ), 'layout' => array( 'label' => esc_html__( 'Layout', 'tutor-lms-divi-modules' ), @@ -223,19 +223,22 @@ public static function get_content( $args = array() ) { '; if ( $course ) { $course_categories = get_tutor_course_categories(); - if ( is_array( $course_categories) && count( $course_categories ) ){ - $count = 1; + if ( is_array( $course_categories ) && count( $course_categories ) ) { + $count = 1; foreach ( $course_categories as $course_category ) { $category_name = $course_category->name; $comma = count( $course_categories ) > $count ? ', ' : ''; $category_link = get_term_link( $course_category->term_id ); $markup .= " $category_name" . $comma; - $count++; + ++$count; } - } - else{ - $markup = '