courses_taken.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Courses taken template |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Profile |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 1.4.3 |
| 10 | */ |
| 11 | |
| 12 | use Tutor\Models\CourseModel; |
| 13 | |
| 14 | $user_name = sanitize_text_field( get_query_var( 'tutor_profile_username' ) ); |
| 15 | $get_user = tutor_utils()->get_user_by_login( $user_name ); |
| 16 | $user_id = $get_user->ID; |
| 17 | |
| 18 | $pageposts = CourseModel::get_courses_by_instructor( $user_id ); |
| 19 | ?> |
| 20 | <div class="tutor-grid tutor-grid-3"> |
| 21 | <?php |
| 22 | if ( $pageposts ) { |
| 23 | global $post; |
| 24 | |
| 25 | //phpcs:ignore |
| 26 | foreach ( $pageposts as $post ) { |
| 27 | setup_postdata( $post ); |
| 28 | |
| 29 | /** |
| 30 | * Usage Idea, you may keep a loop within a wrap, such as bootstrap col |
| 31 | * |
| 32 | * @hook tutor_course/archive/before_loop_course |
| 33 | * @type action |
| 34 | */ |
| 35 | do_action( 'tutor_course/archive/before_loop_course' ); |
| 36 | |
| 37 | tutor_load_template( 'loop.course' ); |
| 38 | |
| 39 | /** |
| 40 | * Usage Idea, If you start any div before course loop, you can end it here, such as </div> |
| 41 | * |
| 42 | * @hook tutor_course/archive/after_loop_course |
| 43 | * @type action |
| 44 | */ |
| 45 | do_action( 'tutor_course/archive/after_loop_course' ); |
| 46 | } |
| 47 | } else { |
| 48 | ?> |
| 49 | <p><?php esc_html_e( 'No course yet.', 'tutor' ); ?></p> |
| 50 | <?php |
| 51 | } |
| 52 | ?> |
| 53 | </div> |
| 54 |