| @@ -1,102 +1,102 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template for displaying content of Featured Courses widget. | |
| 4 | - * | |
| 5 | - * This template can be overridden by copying it to yourtheme/learnpress/widgets/featured-courses/default.php. | |
| 6 | - * | |
| 7 | - * @author ThimPress | |
| 8 | - * @category Widgets | |
| 9 | - * @package Learnpress/Templates | |
| 10 | - * @version 4.1.4 | |
| 11 | - * | |
| 12 | - * @author Nhamdv | |
| 13 | - */ | |
| 14 | - | |
| 15 | -defined( 'ABSPATH' ) || exit(); | |
| 16 | - | |
| 17 | -if ( ! isset( $instance ) ) { | |
| 18 | - return; | |
| 19 | -} | |
| 20 | - | |
| 21 | -if ( ! isset( $courses ) ) { | |
| 22 | - esc_html_e( 'No courses', 'learnpress' ); | |
| 23 | - | |
| 24 | - return; | |
| 25 | -} | |
| 26 | - | |
| 27 | -global $post; | |
| 28 | -?> | |
| 29 | - | |
| 30 | -<div class="lp-widget-featured-courses <?php echo esc_attr( $instance['css_class'] ); ?>"> | |
| 31 | - <div class="lp-widget-featured-courses__content"> | |
| 32 | - <?php | |
| 33 | - foreach ( $courses as $course_id ) { | |
| 34 | - if ( empty( $course_id ) ) { | |
| 35 | - continue; | |
| 36 | - } | |
| 37 | - | |
| 38 | - $post = get_post( $course_id ); | |
| 39 | - setup_postdata( $post ); | |
| 40 | - $course = learn_press_get_course( $course_id ); | |
| 41 | - ?> | |
| 42 | - | |
| 43 | - <div class="lp-widget-course"> | |
| 44 | - | |
| 45 | - <!-- course thumbnail --> | |
| 46 | - <?php if ( ! empty( $instance['show_thumbnail'] ) && $course->get_image( 'medium' ) ) : ?> | |
| 47 | - <div class="lp-widget-course__image"> | |
| 48 | - <a href="<?php echo esc_url_raw( $course->get_permalink() ); ?>"> | |
| 49 | - <?php echo wp_kses_post( $course->get_image( 'medium' ) ); ?> | |
| 50 | - </a> | |
| 51 | - </div> | |
| 52 | - <?php endif; ?> | |
| 53 | - | |
| 54 | - <div class="lp-widget-course__content"> | |
| 55 | - <!-- course title --> | |
| 56 | - <a href="<?php echo esc_url_raw( get_the_permalink( $course->get_id() ) ); ?>"> | |
| 57 | - <h3 class="lp-widget-course__title"><?php echo esc_html( $course->get_title() ); ?></h3> | |
| 58 | - </a> | |
| 59 | - | |
| 60 | - <!-- course content --> | |
| 61 | - <?php if ( ! empty( $instance['desc_length'] ) && absint( $instance['desc_length'] ) > 0 ) : ?> | |
| 62 | - <div class="lp-widget-course__description"> | |
| 63 | - <?php echo wp_kses_post( $course->get_content( 'raw', absint( $instance['desc_length'] ), '...' ) ); ?> | |
| 64 | - </div> | |
| 65 | - <?php endif; ?> | |
| 66 | - | |
| 67 | - <div class="lp-widget-course__meta"> | |
| 68 | - <!-- price --> | |
| 69 | - <?php if ( ! empty( $instance['show_price'] ) ) : ?> | |
| 70 | - <div class="course-price"> | |
| 71 | - <div class="lp-widget-course__price"> | |
| 72 | - <?php echo wp_kses_post( $course->get_course_price_html() ); ?> | |
| 73 | - </div> | |
| 74 | - </div> | |
| 75 | - <?php endif; ?> | |
| 76 | - | |
| 77 | - <!-- instructor --> | |
| 78 | - <?php if ( ! empty( $instance['show_teacher'] ) ) : ?> | |
| 79 | - <div class="lp-widget-course__instructor"> | |
| 80 | - <span class="lp-widget-course__instructor__avatar"> | |
| 81 | - <?php echo wp_kses_post( $course->get_instructor()->get_profile_picture() ); ?> | |
| 82 | - </span> | |
| 83 | - <?php echo wp_kses_post( $course->get_instructor_html() ); ?> | |
| 84 | - </div> | |
| 85 | - <?php endif; ?> | |
| 86 | - </div> | |
| 87 | - </div> | |
| 88 | - </div> | |
| 89 | - <?php } ?> | |
| 90 | - | |
| 91 | - <?php wp_reset_postdata(); ?> | |
| 92 | - </div> | |
| 93 | - | |
| 94 | - <div class="lp-widget-featured-courses__footer"> | |
| 95 | - <?php if ( ! empty( $instance['bottom_link_text'] ) && learn_press_get_page_link( 'courses' ) ) : ?> | |
| 96 | - <a class="lp-widget-featured-courses__footer__link" | |
| 97 | - href="<?php echo esc_url_raw( learn_press_get_page_link( 'courses' ) ); ?>" rel="nofllow"> | |
| 98 | - <?php echo wp_kses_post( $instance['bottom_link_text'] ); ?> | |
| 99 | - </a> | |
| 100 | - <?php endif; ?> | |
| 101 | - </div> | |
| 102 | -</div> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template for displaying content of Featured Courses widget. | |
| 4 | + * | |
| 5 | + * This template can be overridden by copying it to yourtheme/learnpress/widgets/featured-courses/default.php. | |
| 6 | + * | |
| 7 | + * @author ThimPress | |
| 8 | + * @category Widgets | |
| 9 | + * @package Learnpress/Templates | |
| 10 | + * @version 4.1.4 | |
| 11 | + * | |
| 12 | + * @author Nhamdv | |
| 13 | + */ | |
| 14 | + | |
| 15 | +defined( 'ABSPATH' ) || exit(); | |
| 16 | + | |
| 17 | +if ( ! isset( $instance ) ) { | |
| 18 | + return; | |
| 19 | +} | |
| 20 | + | |
| 21 | +if ( ! isset( $courses ) ) { | |
| 22 | + esc_html_e( 'No courses', 'learnpress' ); | |
| 23 | + | |
| 24 | + return; | |
| 25 | +} | |
| 26 | + | |
| 27 | +global $post; | |
| 28 | +?> | |
| 29 | + | |
| 30 | +<div class="lp-widget-featured-courses <?php echo esc_attr( $instance['css_class'] ); ?>"> | |
| 31 | + <div class="lp-widget-featured-courses__content"> | |
| 32 | + <?php | |
| 33 | + foreach ( $courses as $course_id ) { | |
| 34 | + if ( empty( $course_id ) ) { | |
| 35 | + continue; | |
| 36 | + } | |
| 37 | + | |
| 38 | + $post = get_post( $course_id ); | |
| 39 | + setup_postdata( $post ); | |
| 40 | + $course = learn_press_get_course( $course_id ); | |
| 41 | + ?> | |
| 42 | + | |
| 43 | + <div class="lp-widget-course"> | |
| 44 | + | |
| 45 | + <!-- course thumbnail --> | |
| 46 | + <?php if ( ! empty( $instance['show_thumbnail'] ) && $course->get_image( 'medium' ) ) : ?> | |
| 47 | + <div class="lp-widget-course__image"> | |
| 48 | + <a href="<?php echo esc_url_raw( $course->get_permalink() ); ?>"> | |
| 49 | + <?php echo wp_kses_post( $course->get_image( 'medium' ) ); ?> | |
| 50 | + </a> | |
| 51 | + </div> | |
| 52 | + <?php endif; ?> | |
| 53 | + | |
| 54 | + <div class="lp-widget-course__content"> | |
| 55 | + <!-- course title --> | |
| 56 | + <a href="<?php echo esc_url_raw( get_the_permalink( $course->get_id() ) ); ?>"> | |
| 57 | + <h3 class="lp-widget-course__title"><?php echo esc_html( $course->get_title() ); ?></h3> | |
| 58 | + </a> | |
| 59 | + | |
| 60 | + <!-- course content --> | |
| 61 | + <?php if ( ! empty( $instance['desc_length'] ) && absint( $instance['desc_length'] ) > 0 ) : ?> | |
| 62 | + <div class="lp-widget-course__description"> | |
| 63 | + <?php echo wp_kses_post( $course->get_content( 'raw', absint( $instance['desc_length'] ), '...' ) ); ?> | |
| 64 | + </div> | |
| 65 | + <?php endif; ?> | |
| 66 | + | |
| 67 | + <div class="lp-widget-course__meta"> | |
| 68 | + <!-- price --> | |
| 69 | + <?php if ( ! empty( $instance['show_price'] ) ) : ?> | |
| 70 | + <div class="course-price"> | |
| 71 | + <div class="lp-widget-course__price"> | |
| 72 | + <?php echo wp_kses_post( $course->get_course_price_html() ); ?> | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + <?php endif; ?> | |
| 76 | + | |
| 77 | + <!-- instructor --> | |
| 78 | + <?php if ( ! empty( $instance['show_teacher'] ) ) : ?> | |
| 79 | + <div class="lp-widget-course__instructor"> | |
| 80 | + <span class="lp-widget-course__instructor__avatar"> | |
| 81 | + <?php echo wp_kses_post( $course->get_instructor()->get_profile_picture() ); ?> | |
| 82 | + </span> | |
| 83 | + <?php echo wp_kses_post( $course->get_instructor_html() ); ?> | |
| 84 | + </div> | |
| 85 | + <?php endif; ?> | |
| 86 | + </div> | |
| 87 | + </div> | |
| 88 | + </div> | |
| 89 | + <?php } ?> | |
| 90 | + | |
| 91 | + <?php wp_reset_postdata(); ?> | |
| 92 | + </div> | |
| 93 | + | |
| 94 | + <div class="lp-widget-featured-courses__footer"> | |
| 95 | + <?php if ( ! empty( $instance['bottom_link_text'] ) && learn_press_get_page_link( 'courses' ) ) : ?> | |
| 96 | + <a class="lp-widget-featured-courses__footer__link" | |
| 97 | + href="<?php echo esc_url_raw( learn_press_get_page_link( 'courses' ) ); ?>" rel="nofllow"> | |
| 98 | + <?php echo wp_kses_post( $instance['bottom_link_text'] ); ?> | |
| 99 | + </a> | |
| 100 | + <?php endif; ?> | |
| 101 | + </div> | |
| 102 | +</div> | |