Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions includes/classes/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
11 changes: 11 additions & 0 deletions includes/modules/CourseAuthor/CourseAuthor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -214,6 +215,16 @@ class CourseAuthor extends Component {
]);
}


if ( props.__author == null ) {
additionalCss.push([
{
selector: course_author_wrapper,
declaration: `display: none !important`
}
]);
}

return additionalCss;
}

Expand Down
15 changes: 13 additions & 2 deletions includes/modules/CourseAuthor/CourseAuthor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 '';
Expand Down
19 changes: 11 additions & 8 deletions includes/modules/CourseCategories/CourseCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down Expand Up @@ -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 .= " <a href='$category_link'>$category_name</a>" . $comma;
$count++;
++$count;
}
}
else{
$markup = '<div class="tutor-single-course-meta-categories tutor-course-details-category tutor-meta tutor-course-details-info">
<div>';
} else {
$markup = sprintf(
'<div class="tutor-single-course-meta-categories tutor-course-details-category tutor-meta tutor-course-details-info">
%s
<div>',
esc_html__( 'Uncategorized', 'tutor-lms-divi-modules' )
);
}
}
$markup .= '</div></div>';
Expand Down
5 changes: 5 additions & 0 deletions includes/modules/CourseRequirements/CourseRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ public static function get_props( $args = array() ) {
public static function get_content( $args = array() ) {
$course_id = Helper::get_course( $args );
ob_start();

if ( ! tutor_utils()->get_option( 'enable_course_requirements', false ) ) {
return '';
}

if ( $course_id ) {
include_once dtlms_get_template( 'course/requirements' );
}
Expand Down
31 changes: 15 additions & 16 deletions includes/templates/course/share.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
<div class="dtlms-course-share-modal-sub-title tutor-fs-7 tutor-color-secondary tutor-mb-12">
<?php esc_html_e( 'Page Link', 'tutor-lms-divi-modules' ) ?>
</div>
<div class="tutor-mb-32">
<input class="tutor-form-control" value="<?php echo get_permalink( $course_id ); ?>" />
<div class="tutor-mb-32 tutor-position-relative">
<input class="tutor-form-control" value="<?php echo get_permalink( $course_id ); ?>" aria-label="<?php esc_attr_e( 'Course Link', 'tutor-lms-divi-modules' ); ?> " readonly />
<button class="tutor-btn tutor-btn-icon tutor-copy-text tutor-position-absolute tutor-bg-white" style="right: 2px; top: 2px;" data-text="<?php echo esc_attr( get_permalink( $course_id ) ); ?>" aria-label="<?php esc_attr_e( 'Copy link', 'tutor-lms-divi-modules' ); ?>">
<span class="icon tutor-icon-copy" aria-hidden="true"></span>
</button>
</div>
<div>
<?php if ( '' !== $share_title ) : ?>
Expand All @@ -66,20 +69,16 @@
<div class="tutor-social-share-wrap" data-social-share-config="<?php echo esc_attr( wp_json_encode( $share_config ) ); ?>">
<?php foreach ( $tutor_social_share_icons as $icon ) : ?>
<button class="tutor-social-share-button tutor_share <?php echo esc_attr( $icon['share_class'] ); ?>" style="background-color: <?php echo esc_attr( $icon['color'] ); ?>">
<span class="social-icon">
<?php
if ( 'on' === $args['show_social_icon'] ) {
echo $icon['icon_html'];
}
?>
</span>
<span>
<?php
if ( 'on' === $args['show_social_text'] ) {
echo esc_html( $icon['text'] );
}
?>
</span>
<?php
if ( 'on' === $args['show_social_icon'] ) {
echo $icon['icon_html'];
}
?>
<?php
if ( 'on' === $args['show_social_text'] ) {
echo esc_html( $icon['text'] );
}
?>
</button>
<?php endforeach; ?>
</div>
Expand Down
Loading