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.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / archive-course-init.php
tutor / templates Last commit date
course-filter 3 years ago dashboard 3 years ago email 4 years ago global 4 years ago instructor 4 years ago loop 3 years ago modal 4 years ago profile 4 years ago shortcode 4 years ago single 3 years ago template-part 3 years ago widget 4 years ago archive-course-init.php 3 years ago archive-course.php 3 years ago course-embed.php 3 years ago course-none.php 3 years ago dashboard.php 3 years ago feature_disabled.php 3 years ago instructor-setting.php 3 years ago login-form.php 3 years ago login.php 3 years ago permission-denied.php 3 years ago public-profile.php 3 years ago single-assignment.php 3 years ago single-content-loader.php 3 years ago single-course.php 3 years ago single-lesson.php 3 years ago single-preview-lesson.php 3 years ago single-quiz.php 3 years ago template.php 3 years ago
archive-course-init.php
170 lines
1 <?php
2 /**
3 * Template for course archive init
4 *
5 * @author Themeum
6 * @link https://themeum.com
7 * @package TutorLMS/Templates
8 * @version 1.0.0
9 */
10
11 ! isset( $course_filter ) ? $course_filter = false : 0;
12 ! isset( $supported_filters ) ? $supported_filters = tutor_utils()->get_option( 'supported_course_filters', array() ) : 0;
13 ! isset( $loop_content_only ) ? $loop_content_only = false : 0;
14 ! isset( $column_per_row ) ? $column_per_row = tutor_utils()->get_option( 'courses_col_per_row', 3 ) : 0;
15 ! isset( $course_per_page ) ? $course_per_page = tutor_utils()->get_option( 'courses_per_page', 12 ) : 0;
16 ! isset( $show_pagination ) ? $show_pagination = true : 0;
17 ! isset( $current_page ) ? $current_page = 1 : 0;
18
19 // Hide pagination is there is no page after first one
20 $pages_count = 0;
21 if ( isset( $the_query ) ) {
22 $pages_count = $the_query->max_num_pages;
23 } else {
24 global $wp_query;
25 $pages_count = $wp_query->max_num_pages;
26 }
27 $pages_count < 2 ? $show_pagination = false : 0;
28
29 // Set in global variable to avoid too many stack to pass to other templates
30 $GLOBALS['tutor_course_archive_arg'] = compact(
31 'course_filter',
32 'supported_filters',
33 'loop_content_only',
34 'column_per_row',
35 'course_per_page',
36 'show_pagination'
37 );
38
39 // Render the loop
40 ob_start();
41 do_action( 'tutor_course/archive/before_loop' );
42
43 if ( ( isset( $the_query ) && $the_query->have_posts() ) || have_posts() ) {
44 /* Start the Loop */
45
46 tutor_course_loop_start();
47
48 while ( isset( $the_query ) ? $the_query->have_posts() : have_posts() ) {
49 isset( $the_query ) ? $the_query->the_post() : the_post();
50
51 /**
52 * @hook tutor_course/archive/before_loop_course
53 * @type action
54 * Usage Idea, you may keep a loop within a wrap, such as bootstrap col
55 */
56 do_action( 'tutor_course/archive/before_loop_course' );
57
58 tutor_load_template( 'loop.course' );
59
60 /**
61 * @hook tutor_course/archive/after_loop_course
62 * @type action
63 * Usage Idea, If you start any div before course loop, you can end it here, such as </div>
64 */
65 do_action( 'tutor_course/archive/after_loop_course' );
66 }
67
68 tutor_course_loop_end();
69 } else {
70
71 /**
72 * No course found
73 */
74 // tutor_load_template('course-none');
75 tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() );
76 }
77
78 do_action( 'tutor_course/archive/after_loop' );
79
80 if ( $show_pagination ) {
81 // Load the pagination now
82 global $wp_query;
83
84 $current_url = wp_doing_ajax() ? $_SERVER['HTTP_REFERER'] : tutor()->current_url;
85 $push_link = add_query_arg( array_merge( $_POST, $GLOBALS['tutor_course_archive_arg'] ), $current_url );
86
87 $data = wp_doing_ajax() ? $_POST : $_GET;
88 $pagination_data = array(
89 'total_page' => isset( $the_query ) ? $the_query->max_num_pages : $wp_query->max_num_pages,
90 'per_page' => $course_per_page,
91 'paged' => $current_page,
92 'data_set' => array( 'push_state_link' => $push_link ),
93 'ajax' => array_merge(
94 $data,
95 array(
96 'loading_container' => '.tutor-course-filter-loop-container',
97 'action' => 'tutor_course_filter_ajax',
98 )
99 ),
100 );
101
102 tutor_load_template_from_custom_path(
103 tutor()->path . 'templates/dashboard/elements/pagination.php',
104 $pagination_data
105 );
106 }
107
108 $course_loop = ob_get_clean();
109
110 if ( isset( $loop_content_only ) && $loop_content_only == true ) {
111 echo $course_loop;
112 return;
113 }
114
115 $course_archive_arg = isset( $GLOBALS['tutor_course_archive_arg'] ) ? $GLOBALS['tutor_course_archive_arg']['column_per_row'] : null;
116 $columns = $course_archive_arg === null ? tutor_utils()->get_option( 'courses_col_per_row', 3 ) : $course_archive_arg;
117 $has_course_filters = $course_filter && count( $supported_filters );
118
119 $supported_filters_keys = array_keys( $supported_filters );
120 ?>
121
122 <div class="tutor-wrap tutor-wrap-parent tutor-courses-wrap tutor-container course-archive-page" data-tutor_courses_meta="<?php echo esc_attr( json_encode( $GLOBALS['tutor_course_archive_arg'] ) ); ?>">
123 <?php if ( $has_course_filters && in_array( 'search', $supported_filters_keys ) ) : ?>
124 <div class="tutor-d-block tutor-d-lg-none tutor-mb-32">
125 <div class="tutor-d-flex tutor-align-center tutor-justify-between">
126 <span class="tutor-fs-3 tutor-fw-medium tutor-color-black"><?php _e( 'Courses', 'tutor' ); ?></span>
127 <a href="#" class="tutor-iconic-btn tutor-iconic-btn-secondary tutor-iconic-btn-md" tutor-toggle-course-filter><span class="tutor-icon-slider-vertical"></span></a>
128 </div>
129 </div>
130 <?php endif; ?>
131
132 <div class="tutor-row tutor-gx-xl-5">
133 <?php if ( $has_course_filters ) : ?>
134 <div class="tutor-col-3 tutor-course-filter-container">
135 <div class="tutor-course-filter" tutor-course-filter>
136 <?php tutor_load_template( 'course-filter.filters' ); ?>
137 </div>
138 </div>
139
140 <!-- <?php if ( $columns < 3 ) : ?>
141 <div class="tutor-col-1 tutor-d-none tutor-d-xl-block" area-hidden="true"></div>
142 <?php endif; ?> -->
143
144 <div class="tutor-col-xl-<?php echo $columns < 3 ? 8 : 9; ?> ">
145 <div>
146 <?php tutor_load_template( 'course-filter.course-archive-filter-bar' ); ?>
147 </div>
148 <div class="tutor-pagination-wrapper-replaceable" tutor-course-list-container>
149 <?php echo $course_loop; ?>
150 </div>
151 </div>
152 <?php else : ?>
153 <div class="tutor-col-12">
154 <div class="">
155 <?php tutor_load_template( 'course-filter.course-archive-filter-bar' ); ?>
156 </div>
157 <div class="tutor-pagination-wrapper-replaceable" tutor-course-list-container>
158 <?php echo $course_loop; ?>
159 </div>
160 </div>
161 <?php endif; ?>
162 </div>
163 </div>
164
165 <?php
166 if ( ! is_user_logged_in() ) {
167 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
168 }
169 ?>
170