PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.1.10
Tutor LMS – eLearning and online course solution v2.1.10
4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.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 / includes / tutor-template-functions.php
tutor / includes Last commit date
theme-compatibility 4 years ago tinymce_translate.php 4 years ago translate-text.php 3 years ago tutor-general-functions.php 3 years ago tutor-template-functions.php 3 years ago tutor-template-hook.php 4 years ago
tutor-template-functions.php
1441 lines
1 <?php
2 /**
3 * Tutor template functions
4 *
5 * @package TutorFunctions
6 * @author Themeum <support@themeum.com>
7 * @link https://themeum.com
8 * @since 1.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * @param null $template
17 * @param bool $tutor_pro
18 *
19 * @return bool|string
20 *
21 * Load template with override file system
22 *
23 * @since v.1.0.0
24 * @updated v.1.4.2
25 * @updated v.1.4.3
26 */
27
28 if ( ! function_exists( 'tutor_get_template' ) ) {
29 function tutor_get_template( $template = null, $tutor_pro = false ) {
30 if ( ! $template ) {
31 return false;
32 }
33 $template = str_replace( '.', DIRECTORY_SEPARATOR, $template );
34
35 /**
36 * Get template first from child-theme if exists
37 * If child theme not exists, then get template from parent theme
38 */
39 $template_location = trailingslashit( get_stylesheet_directory() ) . "tutor/{$template}.php";
40 if ( ! file_exists( $template_location ) ) {
41 $template_location = trailingslashit( get_template_directory() ) . "tutor/{$template}.php";
42 }
43 $file_in_theme = $template_location;
44 if ( ! file_exists( $template_location ) ) {
45 $template_location = trailingslashit( tutor()->path ) . "templates/{$template}.php";
46
47 if ( $tutor_pro && function_exists( 'tutor_pro' ) ) {
48 $pro_template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
49 if ( file_exists( $pro_template_location ) ) {
50 $template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
51 }
52 }
53
54 if ( ! file_exists( $template_location ) ) {
55 $warning_msg = __( 'The file you are trying to load does not exist in your theme or Tutor LMS plugin location. If you are extending the Tutor LMS plugin, please create a php file here: ', 'tutor' );
56 $warning_msg = $warning_msg . "<code>$file_in_theme</code>";
57 $warning_msg = apply_filters( 'tutor_not_found_template_warning_msg', $warning_msg );
58 echo wp_kses( $warning_msg, array( 'code' => true ) );
59 ?>
60 <?php
61 }
62 }
63
64 return apply_filters( 'tutor_get_template_path', $template_location, $template );
65 }
66 }
67
68 /**
69 * @param null $template
70 * @param bool $tutor_pro
71 *
72 * @return bool|mixed|void
73 *
74 * Get only template path without any warning...
75 *
76 * @since v.1.4.2
77 */
78 if ( ! function_exists( 'tutor_get_template_path' ) ) {
79 function tutor_get_template_path( $template = null, $tutor_pro = false ) {
80 if ( ! $template ) {
81 return false;
82 }
83 $template = str_replace( '.', DIRECTORY_SEPARATOR, $template );
84
85 /**
86 * Get template first from child-theme if exists
87 * If child theme not exists, then get template from parent theme
88 */
89 $template_location = trailingslashit( get_stylesheet_directory() ) . "tutor/{$template}.php";
90 if ( ! file_exists( $template_location ) ) {
91 $template_location = trailingslashit( get_template_directory() ) . "tutor/{$template}.php";
92 }
93 if ( ! file_exists( $template_location ) ) {
94 $template_location = trailingslashit( tutor()->path ) . "templates/{$template}.php";
95 }
96 if ( ! file_exists( $template_location ) && $tutor_pro && function_exists( 'tutor_pro' ) ) {
97 $template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
98 }
99
100 return apply_filters( 'tutor_get_template_path', $template_location, $template );
101 }
102 }
103
104 /**
105 * @param null $template
106 *
107 * @param array $variables
108 *
109 * Load template for TUTOR
110 *
111 * @since v.1.0.0
112 *
113 * @updated v.1.1.2
114 */
115
116 if ( ! function_exists( 'tutor_load_template' ) ) {
117 function tutor_load_template( $template = null, $variables = array(), $tutor_pro = false ) {
118 $variables = (array) $variables;
119 $variables = apply_filters( 'get_tutor_load_template_variables', $variables );
120 extract( $variables );
121
122 $isLoad = apply_filters( 'should_tutor_load_template', true, $template, $variables );
123 if ( ! $isLoad ) {
124 return;
125 }
126
127 do_action( 'tutor_load_template_before', $template, $variables );
128 $template_file = tutor_get_template( $template, $tutor_pro );
129 if ( file_exists( $template_file ) ) {
130 include tutor_get_template( $template, $tutor_pro );
131 } else {
132 do_action( 'tutor_after_template_not_found', $template );
133 }
134 do_action( 'tutor_load_template_after', $template, $variables );
135 }
136 }
137
138 /**
139 * @param null $template
140 * @param array $variables
141 * @param bool $tutor_pro
142 *
143 * @since v.1.4.3
144 */
145
146 if ( ! function_exists( 'tutor_load_template_part' ) ) {
147 function tutor_load_template_part( $template = null, $variables = array(), $tutor_pro = false ) {
148 $variables = (array) $variables;
149 $variables = apply_filters( 'get_tutor_load_template_variables', $variables );
150 extract( $variables );
151
152 /**
153 * Get template first from child-theme if exists
154 * If child theme not exists, then get template from parent theme
155 */
156 $template_location = trailingslashit( get_stylesheet_directory() ) . 'tutor/template.php';
157 if ( ! file_exists( $template_location ) ) {
158 $template_location = trailingslashit( get_template_directory() ) . 'tutor/template.php';
159 }
160
161 if ( ! file_exists( $template_location ) ) {
162 $template_location = trailingslashit( tutor()->path ) . 'templates/template.php';
163 if ( ! file_exists( $template_location ) && $tutor_pro && function_exists( 'tutor_pro' ) ) {
164 $template_location = trailingslashit( tutor_pro()->path ) . 'templates/template.php';
165 }
166 }
167
168 include apply_filters( 'tutor_get_template_part_path', $template_location, $template );
169 }
170 }
171
172 /**
173 * @param $template_name
174 * @param array $variables
175 *
176 * @return string
177 *
178 * @since v.1.4.3
179 */
180
181 if ( ! function_exists( 'tutor_get_template_html' ) ) {
182 function tutor_get_template_html( $template_name, $variables = array(), $tutor_pro = false ) {
183 ob_start();
184 tutor_load_template( $template_name, $variables, $tutor_pro );
185
186 return ob_get_clean();
187 }
188 }
189
190 if ( ! function_exists( 'tutor_course_loop_start' ) ) {
191 function tutor_course_loop_start( $echo = true ) {
192 ob_start();
193 tutor_load_template( 'loop.loop-start' );
194 $output = apply_filters( 'tutor_course_loop_start', ob_get_clean() );
195
196 if ( $echo ) {
197 echo tutor_kses_html( $output ); //phpcs:ignore
198 }
199 return $output;
200 }
201 }
202
203 if ( ! function_exists( 'tutor_course_loop_end' ) ) {
204 function tutor_course_loop_end( $echo = true ) {
205 ob_start();
206 tutor_load_template( 'loop.loop-end' );
207
208 $output = apply_filters( 'tutor_course_loop_end', ob_get_clean() );
209 if ( $echo ) {
210 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
211 }
212
213 return $output;
214 }
215 }
216
217 function tutor_course_loop_before_content() {
218 ob_start();
219 tutor_load_template( 'loop.loop-before-content' );
220
221 $output = apply_filters( 'tutor_course_loop_before_content', ob_get_clean() );
222 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
223 }
224
225 function tutor_course_loop_after_content() {
226 ob_start();
227 tutor_load_template( 'loop.loop-after-content' );
228
229 $output = apply_filters( 'tutor_course_loop_after_content', ob_get_clean() );
230 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
231 }
232
233 if ( ! function_exists( 'tutor_course_loop_title' ) ) {
234 function tutor_course_loop_title() {
235 ob_start();
236 tutor_load_template( 'loop.title' );
237 $output = apply_filters( 'tutor_course_loop_title', ob_get_clean() );
238
239 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
240 }
241 }
242
243
244 if ( ! function_exists( 'tutor_course_loop_header' ) ) {
245 function tutor_course_loop_header() {
246 ob_start();
247 tutor_load_template( 'loop.header' );
248 $output = apply_filters( 'tutor_course_loop_header', ob_get_clean() );
249
250 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
251 }
252 }
253
254 if ( ! function_exists( 'tutor_course_loop_footer' ) ) {
255 function tutor_course_loop_footer() {
256 ob_start();
257 tutor_load_template( 'loop.footer' );
258 $output = apply_filters( 'tutor_course_loop_footer', ob_get_clean() );
259
260 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
261 }
262 }
263
264 // tutor_course_loop_footer
265
266
267 if ( ! function_exists( 'tutor_course_loop_start_content_wrap' ) ) {
268 function tutor_course_loop_start_content_wrap() {
269 ob_start();
270 tutor_load_template( 'loop.start_content_wrap' );
271 $output = apply_filters( 'tutor_course_loop_start_content_wrap', ob_get_clean() );
272
273 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
274 }
275 }
276
277 if ( ! function_exists( 'tutor_course_loop_end_content_wrap' ) ) {
278 function tutor_course_loop_end_content_wrap() {
279 ob_start();
280 tutor_load_template( 'loop.end_content_wrap' );
281 $output = apply_filters( 'tutor_course_loop_end_content_wrap', ob_get_clean() );
282
283 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
284 }
285 }
286
287 if ( ! function_exists( 'tutor_course_loop_thumbnail' ) ) {
288 function tutor_course_loop_thumbnail( $echo = true ) {
289 ob_start();
290 tutor_load_template( 'loop.thumbnail' );
291 $output = apply_filters( 'tutor_course_loop_thumbnail', ob_get_clean() );
292
293 if ( $echo ) {
294 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
295 } else {
296 return $output;
297 }
298 }
299 }
300
301 if ( ! function_exists( 'tutor_course_loop_wrap_classes' ) ) {
302 function tutor_course_loop_wrap_classes( $echo = true ) {
303 $courseID = get_the_ID();
304 $classes = apply_filters(
305 'tutor_course_loop_wrap_classes',
306 array(
307 'tutor-course',
308 'tutor-course-loop',
309 'tutor-course-loop-' . $courseID,
310 )
311 );
312
313 $class = implode( ' ', $classes );
314 if ( $echo ) {
315 echo esc_attr( $class );
316 }
317
318 return esc_attr( $class );
319 }
320 }
321
322 if ( ! function_exists( 'tutor_course_loop_col_classes' ) ) {
323 function tutor_course_loop_col_classes( $echo = true ) {
324 $course_filter = (bool) tutor_utils()->get_option( 'course_archive_filter', false );
325 $course_archive_arg = isset( $GLOBALS['tutor_course_archive_arg'] ) ? $GLOBALS['tutor_course_archive_arg']['column_per_row'] : null;
326 $course_cols = $course_archive_arg === null ? tutor_utils()->get_option( 'courses_col_per_row', 3 ) : $course_archive_arg;
327 $classes = apply_filters(
328 'tutor_course_loop_col_classes',
329 array(
330 'tutor-col-' . $course_cols,
331 )
332 );
333
334 $class = implode( ' ', $classes );
335 if ( $echo ) {
336 echo esc_attr( $class );
337 }
338
339 return esc_attr( $class );
340 }
341 }
342
343
344 if ( ! function_exists( 'tutor_container_classes' ) ) {
345 function tutor_container_classes( $echo = true ) {
346
347 $classes = apply_filters(
348 'tutor_container_classes',
349 array(
350 'tutor-wrap tutor-courses-wrap',
351 'tutor-container',
352 )
353 );
354
355 $classes = apply_filters(
356 'tutor_container_classes',
357 array(
358 'tutor-wrap tutor-courses-wrap',
359 'tutor-container',
360 )
361 );
362
363 $class = implode( ' ', $classes );
364
365 if ( $echo ) {
366 echo esc_attr( $class );
367 }
368
369 return esc_attr( $class );
370 }
371 }
372 if ( ! function_exists( 'tutor_post_class' ) ) {
373 function tutor_post_class( $default = '' ) {
374 $classes = apply_filters(
375 'tutor_post_class',
376 array(
377 'tutor-wrap',
378 $default,
379 )
380 );
381
382 post_class( $classes );
383 }
384 }
385
386 /**
387 *
388 * Get classes for widget loop single course wrap
389 *
390 * @param bool $echo
391 *
392 * @return string
393 *
394 * @since v.1.3.1
395 */
396 if ( ! function_exists( 'tutor_widget_course_loop_classes' ) ) {
397 function tutor_widget_course_loop_classes( $echo = true ) {
398
399 $classes = apply_filters(
400 'tutor_widget_course_loop_classes',
401 array(
402 'tutor-widget-course-loop',
403 'tutor-widget-course',
404 'tutor-widget-course-' . get_the_ID(),
405 )
406 );
407
408 $class = implode( ' ', $classes );
409 if ( $echo ) {
410 echo esc_attr( $class );
411 }
412
413 return esc_attr( $class );
414 }
415 }
416
417 /**
418 * Get the post thumbnail
419 */
420 if ( ! function_exists( 'get_tutor_course_thumbnail' ) ) {
421 function get_tutor_course_thumbnail( $size = 'post-thumbnail', $url = false ) {
422 $post_id = get_the_ID();
423 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
424 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
425 $placeHolderUrl = tutor()->url . 'assets/images/placeholder.svg';
426 $thumb_url = $post_thumbnail_id ? wp_get_attachment_image_url( $post_thumbnail_id, $size ) : $placeHolderUrl;
427
428 if ( $url ) {
429 return $thumb_url;
430 }
431
432 echo '<div class="tutor-course-thumbnail">
433 <img src="' . esc_url( $thumb_url ) . '" />
434 </div>';
435 }
436 }
437 /**
438 * Get the course/post thumbnail src
439 */
440 if ( ! function_exists( 'get_tutor_course_thumbnail_src' ) ) {
441 function get_tutor_course_thumbnail_src( $size = 'post-thumbnail' ) {
442 $post_id = get_the_ID();
443 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
444
445 if ( $post_thumbnail_id ) {
446 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
447 $src = wp_get_attachment_image_url( $post_thumbnail_id, $size, false );
448 } else {
449 $src = tutor()->url . 'assets/images/placeholder.svg';
450 }
451
452 return $src;
453 }
454 }
455
456 if ( ! function_exists( 'tutor_course_loop_meta' ) ) {
457 function tutor_course_loop_meta() {
458 ob_start();
459 tutor_load_template( 'loop.meta' );
460 $output = apply_filters( 'tutor_course_loop_meta', ob_get_clean() );
461
462 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
463 }
464 }
465
466 /**
467 * Get course author name in loop
468 *
469 * @since: v.1.0.0
470 */
471
472 if ( ! function_exists( 'tutor_course_loop_author' ) ) {
473 function tutor_course_loop_author() {
474 ob_start();
475 tutor_load_template( 'loop.course-author' );
476 $output = apply_filters( 'tutor_course_loop_author', ob_get_clean() );
477
478 echo $output; //phpcs:ignore -- data already escaped inside template file
479 }
480 }
481
482 /**
483 * Get formatted price with cart form
484 */
485
486 if ( ! function_exists( 'tutor_course_loop_price' ) ) {
487 function tutor_course_loop_price() {
488
489 ob_start();
490
491 $course_id = get_the_ID();
492 $can_continue = tutor_utils()->is_enrolled( $course_id ) || get_post_meta( $course_id, '_tutor_is_public_course', true ) == 'yes';
493
494 // Check for further access type like course content access settings
495 if ( ! $can_continue ) {
496 $can_continue = tutor_utils()->has_user_course_content_access( get_current_user_id(), $course_id );
497 }
498
499 if ( $can_continue ) {
500 tutor_load_template( 'loop.course-continue' );
501
502 } elseif ( tutor_utils()->is_course_added_to_cart( $course_id ) ) {
503 tutor_load_template( 'loop.course-in-cart' );
504
505 } else {
506 $tutor_course_sell_by = apply_filters( 'tutor_course_sell_by', null );
507
508 if ( $tutor_course_sell_by && ( tutor_utils()->is_course_purchasable( $course_id ) || ! is_user_logged_in() ) ) {
509 tutor_load_template( 'loop.course-price-' . $tutor_course_sell_by );
510 } else {
511 tutor_load_template( 'loop.course-price' );
512 }
513 }
514 echo apply_filters( 'tutor_course_loop_price', ob_get_clean() ); //phpcs:ignore -- already escaped inside template file
515 }
516 }
517
518 /**
519 * Get Course rating
520 *
521 * @since v.1.0.0
522 * @updated v.1.4.5
523 */
524
525 if ( ! function_exists( 'tutor_course_loop_rating' ) ) {
526 function tutor_course_loop_rating() {
527
528 $disable = ! get_tutor_option( 'enable_course_review' );
529 if ( $disable ) {
530 return;
531 }
532
533 ob_start();
534 tutor_load_template( 'loop.rating' );
535 $output = apply_filters( 'tutor_course_loop_rating', ob_get_clean() );
536
537 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
538 }
539 }
540
541 /**
542 * @param bool $echo
543 *
544 * @return mixed|void
545 *
546 * Get add to cart form
547 */
548
549 if ( ! function_exists( 'tutor_course_loop_add_to_cart' ) ) {
550 function tutor_course_loop_add_to_cart( $echo = true ) {
551 ob_start();
552 $tutor_course_sell_by = apply_filters( 'tutor_course_sell_by', null );
553
554 if ( $tutor_course_sell_by ) {
555 tutor_load_template( 'loop.add-to-cart-' . $tutor_course_sell_by );
556 }
557
558 $output = apply_filters( 'tutor_course_loop_add_to_cart_link', ob_get_clean() );
559
560 if ( $echo ) {
561 echo wp_kses_post( $output );
562 }
563 return $output;
564 }
565 }
566
567 if ( ! function_exists( 'tutor_course_price' ) ) {
568 function tutor_course_price() {
569 ob_start();
570 tutor_load_template( 'single.course.wc-price-html' );
571 $output = apply_filters( 'tutor_course_price', ob_get_clean() );
572
573 echo $output; //phpcs:ignore -- data already escaped inside template file
574 }
575 }
576
577 /**
578 * @param int $post_id
579 *
580 * echo the excerpt of TUTOR post type
581 *
582 * @since: v.1.0.0
583 */
584 if ( ! function_exists( 'tutor_the_excerpt' ) ) {
585 function tutor_the_excerpt( $post_id = 0 ) {
586 if ( ! $post_id ) {
587 $post_id = get_the_ID();
588 }
589 echo esc_textarea( tutor_get_the_excerpt( $post_id ) );
590 }
591 }
592 /**
593 * @param int $post_id
594 *
595 * @return mixed
596 *
597 * Return excerpt of TUTOR post type
598 *
599 * @since: v.1.0.0
600 */
601 if ( ! function_exists( 'tutor_get_the_excerpt' ) ) {
602 function tutor_get_the_excerpt( $post_id = 0 ) {
603 if ( ! $post_id ) {
604 $post_id = get_the_ID();
605 }
606
607 $get_post = get_post( $post_id );
608 return apply_filters( 'tutor_get_the_excerpt', $get_post->post_excerpt );
609 }
610 }
611
612 /**
613 * @return mixed
614 *
615 * return course author
616 *
617 * @since: v.1.0.0
618 */
619
620 if ( ! function_exists( 'get_tutor_course_author' ) ) {
621 function get_tutor_course_author() {
622 global $post;
623 return apply_filters( 'get_tutor_course_author', get_the_author_meta( 'display_name', $post->post_author ) );
624 }
625 }
626
627 function get_tutor_course_author_id() {
628 global $post;
629 return (int) $post->post_author;
630 }
631
632 /**
633 * @param int $course_id
634 *
635 * @return mixed
636 * Course benefits return array
637 *
638 * @since: v.1.0.0
639 */
640
641 if ( ! function_exists( 'tutor_course_benefits' ) ) {
642 function tutor_course_benefits( $course_id = 0 ) {
643 if ( ! $course_id ) {
644 $course_id = get_the_ID();
645 }
646 $benefits = get_post_meta( $course_id, '_tutor_course_benefits', true );
647
648 $benefits_array = array();
649 if ( $benefits ) {
650 $benefits_array = explode( "\n", $benefits );
651 }
652
653 $array = array_filter( array_map( 'trim', $benefits_array ) );
654
655 return apply_filters( 'tutor_course/single/benefits', $array, $course_id );
656 }
657 }
658
659 /**
660 * @param bool $echo
661 *
662 * @return mixed
663 *
664 * Course single page benefits
665 *
666 * @since: v.1.0.0
667 */
668
669 if ( ! function_exists( 'tutor_course_benefits_html' ) ) {
670 function tutor_course_benefits_html( $echo = true ) {
671 ob_start();
672 tutor_load_template( 'single.course.course-benefits' );
673 $output = apply_filters( 'tutor_course/single/benefits_html', ob_get_clean() );
674
675 if ( $echo ) {
676 echo wp_kses_post( $output );
677 }
678 return $output;
679 }
680 }
681
682 /**
683 * @param bool $echo
684 *
685 * @return mixed|void
686 *
687 * Return Topics HTML
688 *
689 * @since: v.1.0.0
690 */
691 if ( ! function_exists( 'tutor_course_topics' ) ) {
692 function tutor_course_topics( $echo = true ) {
693 ob_start();
694 tutor_load_template( 'single.course.course-topics' );
695 $output = apply_filters( 'tutor_course/single/topics', ob_get_clean() );
696 wp_reset_postdata();
697
698 if ( $echo ) {
699 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
700 }
701
702 return $output;
703 }
704 }
705
706 /**
707 * @param int $course_id
708 *
709 * @return mixed|void
710 *
711 * return course requirements in array
712 *
713 * @since: v.1.0.0
714 */
715 if ( ! function_exists( 'tutor_course_requirements' ) ) {
716 function tutor_course_requirements( $course_id = 0 ) {
717 if ( ! $course_id ) {
718 $course_id = get_the_ID();
719 }
720 $requirements = get_post_meta( $course_id, '_tutor_course_requirements', true );
721
722 $requirements_array = array();
723 if ( $requirements ) {
724 $requirements_array = explode( "\n", $requirements );
725 }
726
727 $array = array_filter( array_map( 'trim', $requirements_array ) );
728 return apply_filters( 'tutor_course/single/requirements', $array, $course_id );
729 }
730 }
731
732 /**
733 * @param bool $echo
734 *
735 * @return mixed|void
736 *
737 * Return course requirements in course single page
738 *
739 * @since: v.1.0.0
740 */
741 if ( ! function_exists( 'tutor_course_requirements_html' ) ) {
742 function tutor_course_requirements_html( $echo = true ) {
743 ob_start();
744 tutor_course_material_includes_html();
745 tutor_load_template( 'single.course.course-requirements' );
746 $output = apply_filters( 'tutor_course/single/requirements_html', ob_get_clean() );
747
748 if ( $echo ) {
749 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
750 }
751 return $output;
752 }
753 }
754
755
756 /**
757 * @param int $course_id
758 *
759 * @return mixed|void
760 *
761 * Return target audience in course single page
762 *
763 * @since: v.1.0.0
764 */
765 if ( ! function_exists( 'tutor_course_target_audience' ) ) {
766 function tutor_course_target_audience( $course_id = 0 ) {
767 if ( ! $course_id ) {
768 $course_id = get_the_ID();
769 }
770 $target_audience = get_post_meta( $course_id, '_tutor_course_target_audience', true );
771
772 $target_audience_array = array();
773 if ( $target_audience ) {
774 $target_audience_array = explode( "\n", $target_audience );
775 }
776
777 $array = array_filter( array_map( 'trim', $target_audience_array ) );
778 return apply_filters( 'tutor_course/single/target_audience', $array, $course_id );
779 }
780 }
781
782 /**
783 * @param bool $echo
784 *
785 * @return mixed|void
786 *
787 * Return target audience in course single page
788 *
789 * @since: v.1.0.0
790 */
791 if ( ! function_exists( 'tutor_course_target_audience_html' ) ) {
792 function tutor_course_target_audience_html( $echo = true ) {
793 ob_start();
794 tutor_load_template( 'single.course.course-target-audience' );
795 $output = apply_filters( 'tutor_course/single/audience_html', ob_get_clean() );
796
797 if ( $echo ) {
798 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
799 }
800 return $output;
801 }
802 }
803
804
805 if ( ! function_exists( 'tutor_course_material_includes' ) ) {
806 function tutor_course_material_includes( $course_id = 0 ) {
807 if ( ! $course_id ) {
808 $course_id = get_the_ID();
809 }
810 $target_audience = get_post_meta( $course_id, '_tutor_course_material_includes', true );
811
812 $target_audience_array = array();
813 if ( $target_audience ) {
814 $target_audience_array = explode( "\n", $target_audience );
815 }
816
817 $array = array_filter( array_map( 'trim', $target_audience_array ) );
818 return apply_filters( 'tutor_course/single/material_includes', $array, $course_id );
819 }
820 }
821
822 if ( ! function_exists( 'tutor_course_material_includes_html' ) ) {
823 function tutor_course_material_includes_html( $echo = true ) {
824 ob_start();
825 tutor_load_template( 'single.course.material-includes' );
826 $output = apply_filters( 'tutor_course/single/material_includes', ob_get_clean() );
827
828 if ( $echo ) {
829 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
830 }
831 return $output;
832 }
833 }
834
835 // tutor_course_material_includes_html
836
837
838 if ( ! function_exists( 'tutor_course_instructors_html' ) ) {
839 function tutor_course_instructors_html( $echo = true ) {
840 $display_course_instructors = tutor_utils()->get_option( 'display_course_instructors' );
841 if ( ! $display_course_instructors ) {
842 return null;
843 }
844
845 ob_start();
846 tutor_load_template( 'single.course.instructors' );
847 $output = apply_filters( 'tutor_course/single/instructors_html', ob_get_clean() );
848
849 if ( $echo ) {
850 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
851 }
852 return $output;
853 }
854 }
855
856 if ( ! function_exists( 'tutor_course_target_reviews_html' ) ) {
857 function tutor_course_target_reviews_html( $echo = true ) {
858 ob_start();
859 tutor_load_template( 'single.course.reviews' );
860
861 $output = apply_filters( 'tutor_course/single/reviews_html', ob_get_clean() );
862
863 if ( $echo ) {
864 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
865 }
866 return $output;
867 }
868 }
869
870 /**
871 * @param bool $echo
872 *
873 * @return mixed
874 *
875 * Course single page main content / description
876 *
877 * @since: v.1.0.0
878 */
879 if ( ! function_exists( 'tutor_course_content' ) ) {
880 function tutor_course_content( $echo = true ) {
881 ob_start();
882 tutor_load_template( 'single.course.course-content' );
883 $output = apply_filters( 'tutor_course/single/content', ob_get_clean() );
884
885 if ( $echo ) {
886 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
887 }
888
889 return $output;
890 }
891 }
892
893 /**
894 * Course single page lead info
895 *
896 * @since: v.1.0.0
897 */
898 if ( ! function_exists( 'tutor_course_lead_info' ) ) {
899 function tutor_course_lead_info( $echo = true ) {
900 ob_start();
901
902 // exit('failed');
903
904 $course_id = get_the_ID();
905 $course_post_type = tutor()->course_post_type;
906 $queryCourse = new WP_Query(
907 array(
908 'p' => $course_id,
909 'post_type' => $course_post_type,
910 )
911 );
912
913 if ( $queryCourse->have_posts() ) {
914 while ( $queryCourse->have_posts() ) {
915 $queryCourse->the_post();
916 tutor_load_template( 'single.course.lead-info' );
917 }
918 wp_reset_postdata();
919 }
920
921 $output = apply_filters( 'tutor_course/single/lead_info', ob_get_clean() );
922
923 if ( $echo ) {
924 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
925 }
926 return $output;
927 }
928 }
929
930 /**
931 * @param bool $echo
932 *
933 * @return mixed|void
934 */
935
936 if ( ! function_exists( 'tutor_course_enrolled_lead_info' ) ) {
937 function tutor_course_enrolled_lead_info( $echo = true ) {
938 ob_start();
939
940 $course_id = get_the_ID();
941 $course_post_type = tutor()->course_post_type;
942 $queryCourse = new WP_Query(
943 array(
944 'p' => $course_id,
945 'post_type' => $course_post_type,
946 )
947 );
948
949 if ( $queryCourse->have_posts() ) {
950 while ( $queryCourse->have_posts() ) {
951 $queryCourse->the_post();
952 tutor_load_template( 'single.course.lead-info' );
953 }
954 wp_reset_postdata();
955 }
956
957 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
958
959 if ( $echo ) {
960 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
961 }
962
963 return $output;
964 }
965 }
966
967 if ( ! function_exists( 'tutor_lesson_lead_info' ) ) {
968 function tutor_lesson_lead_info( $lesson_id = 0, $echo = true ) {
969 if ( ! $lesson_id ) {
970 $lesson_id = get_the_ID();
971 }
972
973 ob_start();
974 $course_id = tutor_utils()->get_course_id_by( 'lesson', $lesson_id );
975 $course_post_type = tutor()->course_post_type;
976 $queryCourse = new WP_Query(
977 array(
978 'p' => $course_id,
979 'post_type' => $course_post_type,
980 )
981 );
982
983 if ( $queryCourse->have_posts() ) {
984 while ( $queryCourse->have_posts() ) {
985 $queryCourse->the_post();
986 tutor_load_template( 'single.course.lead-info' );
987 }
988 wp_reset_postdata();
989 }
990 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
991
992 if ( $echo ) {
993 echo $output; //phpcs:ignore -- already escaped inside template file
994 }
995
996 return $output;
997
998 }
999 }
1000
1001 if ( ! function_exists( 'tutor_course_video' ) ) {
1002 function tutor_course_video( $echo = true ) {
1003 ob_start();
1004 tutor_load_template( 'single.video.video' );
1005 $output = apply_filters( 'tutor_course/single/video', ob_get_clean() );
1006
1007 if ( $echo ) {
1008 echo $output; //phpcs:ignore -- already escaped inside template file
1009 }
1010 return $output;
1011 }
1012 }
1013
1014 if ( ! function_exists( 'tutor_lesson_video' ) ) {
1015 function tutor_lesson_video( $echo = true ) {
1016 ob_start();
1017 tutor_load_template( 'single.video.video' );
1018 $output = apply_filters( 'tutor_lesson/single/video', ob_get_clean() );
1019
1020 if ( $echo ) {
1021 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1022 }
1023 return $output;
1024 }
1025 }
1026
1027 /**
1028 *
1029 * Get all lessons attachments
1030 *
1031 * @param bool $echo
1032 *
1033 * @return mixed
1034 *
1035 * @since v.1.0.0
1036 */
1037 if ( ! function_exists( 'get_tutor_posts_attachments' ) ) {
1038 function get_tutor_posts_attachments( $echo = true ) {
1039 ob_start();
1040 tutor_load_template( 'global.attachments' );
1041 $output = apply_filters( 'tutor_lesson/single/attachments', ob_get_clean() );
1042
1043 if ( $echo ) {
1044 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1045 }
1046 return $output;
1047 }
1048 }
1049
1050 /**
1051 * @param bool $echo
1052 *
1053 * @return mixed
1054 *
1055 * Render Lesson Main Content
1056 * @since v.1.0.0
1057 */
1058 if ( ! function_exists( 'tutor_lesson_content' ) ) {
1059 function tutor_lesson_content( $echo = true ) {
1060 ob_start();
1061 tutor_load_template( 'single.lesson.content' );
1062 $output = apply_filters( 'tutor_lesson/single/content', ob_get_clean() );
1063
1064 if ( $echo ) {
1065 echo $output; //phpcs:ignore -- already escaped inside template file
1066 }
1067
1068 return $output;
1069 }
1070 }
1071
1072 if ( ! function_exists( 'tutor_lesson_mark_complete_html' ) ) {
1073 function tutor_lesson_mark_complete_html( $echo = true ) {
1074 ob_start();
1075 tutor_load_template( 'single.lesson.complete_form' );
1076 $output = apply_filters( 'tutor_lesson/single/complete_form', ob_get_clean() );
1077
1078 if ( $echo ) {
1079 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1080 }
1081
1082 return $output;
1083 }
1084 }
1085
1086 function tutor_course_question_and_answer( $echo = true ) {
1087 ob_start();
1088 tutor_load_template( 'single.course.enrolled.question_and_answer' );
1089 $output = apply_filters( 'tutor_course/single/question_and_answer', ob_get_clean() );
1090
1091 if ( $echo ) {
1092 echo $output; //phpcs:ignore -- already escaped inside template file
1093 }
1094
1095 return $output;
1096 }
1097
1098 /**
1099 * @param bool $echo
1100 *
1101 * @return mixed
1102 *
1103 * @show progress bar about course complete
1104 *
1105 * @since v.2.0.0
1106 *
1107 * Course Curriculum added
1108 *
1109 * @since v2.0.5
1110 */
1111
1112 function tutor_course_info_tab() {
1113 tutor_course_content();
1114 tutor_course_benefits_html();
1115 tutor_course_topics();
1116 }
1117
1118
1119 function tutor_course_announcements( $echo = true ) {
1120 ob_start();
1121 tutor_load_template( 'single.course.enrolled.announcements' );
1122 $output = apply_filters( 'tutor_course/single/announcements', ob_get_clean() );
1123
1124 if ( $echo ) {
1125 echo $output; //phpcs:ignore -- already escaped inside template file
1126 }
1127
1128 return $output;
1129 }
1130
1131 function tutor_single_quiz_top( $echo = true ) {
1132 ob_start();
1133 tutor_load_template( 'single.quiz.top' );
1134 $output = apply_filters( 'tutor_single_quiz/top', ob_get_clean() );
1135
1136 if ( $echo ) {
1137 echo $output; //phpcs:ignore -- already escaped inside template file
1138 }
1139 return $output;
1140 }
1141
1142 function tutor_single_quiz_body( $echo = true ) {
1143 ob_start();
1144 tutor_load_template( 'single.quiz.body' );
1145 $output = apply_filters( 'tutor_single_quiz/body', ob_get_clean() );
1146
1147 if ( $echo ) {
1148 echo $output; //phpcs:ignore -- data already escaped inside template file
1149 }
1150 return $output;
1151 }
1152
1153 /**
1154 * @param bool $echo
1155 *
1156 * @return mixed|void
1157 *
1158 * Get the quiz description
1159 */
1160 function tutor_single_quiz_content( $echo = true ) {
1161 ob_start();
1162 tutor_load_template( 'single.quiz.content' );
1163 $output = apply_filters( 'tutor_single_quiz/content', ob_get_clean() );
1164
1165 if ( $echo ) {
1166 echo $output; //phpcs:ignore -- already escaped inside template file
1167 }
1168 return $output;
1169 }
1170
1171
1172 function tutor_single_quiz_no_course_belongs( $echo = true ) {
1173 ob_start();
1174 tutor_load_template( 'single.quiz.no_course_belongs' );
1175 $output = apply_filters( 'tutor_single_quiz/no_course_belongs', ob_get_clean() );
1176
1177 if ( $echo ) {
1178 echo $output; //phpcs:ignore -- already escaped inside template file
1179 }
1180 return $output;
1181 }
1182
1183 function single_quiz_contents( $echo = true ) {
1184
1185 ob_start();
1186 tutor_load_template( 'single.quiz.single_quiz_contents' );
1187 $output = apply_filters( 'tutor_single_quiz/single_quiz_contents', ob_get_clean() );
1188
1189 if ( $echo ) {
1190 echo $output; //phpcs:ignore -- already escaped inside template file
1191 }
1192 return $output;
1193 }
1194
1195 function get_tutor_course_level( $course_id = 0 ) {
1196 if ( ! $course_id ) {
1197 $course_id = get_the_ID();
1198 }
1199 if ( ! $course_id ) {
1200 return '';
1201 }
1202
1203 $course_level = get_post_meta( $course_id, '_tutor_course_level', true );
1204
1205 if ( $course_level ) {
1206 return tutor_utils()->course_levels( $course_level );
1207 }
1208 return false;
1209 }
1210
1211 if ( ! function_exists( 'get_tutor_course_duration_context' ) ) {
1212 function get_tutor_course_duration_context( $course_id = 0, $short_form = false ) {
1213 if ( ! $course_id ) {
1214 $course_id = get_the_ID();
1215 }
1216 if ( ! $course_id ) {
1217 return '';
1218 }
1219 $duration = get_post_meta( $course_id, '_course_duration', true );
1220 $durationHours = tutor_utils()->avalue_dot( 'hours', $duration );
1221 $durationMinutes = tutor_utils()->avalue_dot( 'minutes', $duration );
1222 $durationSeconds = tutor_utils()->avalue_dot( 'seconds', $duration );
1223
1224 $hour_format = $short_form ? __( 'h', 'tutor' ) : ' ' . ( $durationHours > 1 ? __( 'hours', 'tutor' ) : __( 'hour', 'tutor' ) );
1225 $minute_format = $short_form ? __( 'm', 'tutor' ) : ' ' . ( $durationMinutes > 1 ? __( 'minutes', 'tutor' ) : __( 'minute', 'tutor' ) );
1226 $second_format = $short_form ? __( 's', 'tutor' ) : ' ' . ( $durationSeconds > 1 ? __( 'seconds', 'tutor' ) : __( 'second', 'tutor' ) );
1227
1228 if ( $duration ) {
1229 $output = '';
1230 if ( $durationHours > 0 ) {
1231 $output .= '<span class="tutor-meta-level">' . ' ' . $durationHours . '</span><span class="tutor-meta-value tutor-color-secondary tutor-mr-4">' . $hour_format . '</span>';
1232 }
1233
1234 if ( $durationMinutes > 0 ) {
1235 $output .= '<span class="tutor-meta-level">' . ' ' . $durationMinutes . '</span><span class="tutor-meta-value tutor-color-secondary tutor-mr-4">' . $minute_format . '</span>';
1236 }
1237
1238 if ( ! $durationHours && ! $durationMinutes && $durationSeconds > 0 ) {
1239 $output .= '<span class="tutor-meta-level">' . ' ' . $durationSeconds . '</span><span class="tutor-meta-value tutor-color-secondary tutor-mr-4">' . $second_format . '</span>';
1240 }
1241
1242 return $output;
1243 }
1244
1245 return false;
1246 }
1247 }
1248 if ( ! function_exists( 'get_tutor_course_categories' ) ) {
1249 function get_tutor_course_categories( $course_id = 0 ) {
1250 if ( ! $course_id ) {
1251 $course_id = get_the_ID();
1252 }
1253 $terms = get_the_terms( $course_id, 'course-category' );
1254
1255 return $terms;
1256 }
1257 }
1258
1259 /**
1260 * @param int $course_id
1261 *
1262 * @return array|false|WP_Error
1263 *
1264 * Get course tags
1265 */
1266
1267 if ( ! function_exists( 'get_tutor_course_tags' ) ) {
1268 function get_tutor_course_tags( $course_id = 0 ) {
1269 if ( ! $course_id ) {
1270 $course_id = get_the_ID();
1271 }
1272 $terms = get_the_terms( $course_id, 'course-tag' );
1273
1274 return $terms;
1275 }
1276 }
1277
1278 /**
1279 * @param bool $echo
1280 *
1281 * @return mixed|void
1282 *
1283 * Template for course tags html
1284 */
1285
1286 if ( ! function_exists( 'tutor_course_tags_html' ) ) {
1287 function tutor_course_tags_html( $echo = true ) {
1288 ob_start();
1289 tutor_load_template( 'single.course.tags' );
1290 $output = apply_filters( 'tutor_course/single/tags_html', ob_get_clean() );
1291
1292 if ( $echo ) {
1293 echo tutor_kses_html( $output );
1294 }
1295
1296 return $output;
1297 }
1298 }
1299
1300 /**
1301 * @param bool $echo
1302 *
1303 * @return mixed
1304 *
1305 * Get Q&A in lesson sidebar
1306 */
1307
1308 if ( ! function_exists( 'tutor_lesson_sidebar_question_and_answer' ) ) {
1309 function tutor_lesson_sidebar_question_and_answer( $echo = true ) {
1310 ob_start();
1311 tutor_load_template( 'single.lesson.sidebar_question_and_answer' );
1312 $output = apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', ob_get_clean() );
1313
1314 if ( $echo ) {
1315 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1316 }
1317
1318 return $output;
1319 }
1320 }
1321
1322 /**
1323 * @param bool $echo
1324 *
1325 * @return mixed
1326 *
1327 * Get Assignment content
1328 *
1329 * @since v.1.3.3
1330 */
1331
1332 if ( ! function_exists( 'tutor_assignment_content' ) ) {
1333 function tutor_assignment_content( $echo = true ) {
1334 ob_start();
1335 tutor_load_template( 'single.assignment.content' );
1336 $output = apply_filters( 'tutor_assignment/single/content', ob_get_clean() );
1337
1338 if ( $echo ) {
1339 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1340 }
1341
1342 return $output;
1343 }
1344 }
1345
1346 /**
1347 * @param string $msg
1348 * @param string $title
1349 * @param string $type
1350 *
1351 * @return string
1352 *
1353 * @since v.1.4.0
1354 */
1355
1356 if ( ! function_exists( 'get_tnotice' ) ) {
1357 function get_tnotice( $msg = '', $title = 'Success', $type = 'success' ) {
1358
1359 $output = '<div class="tnotice tnotice--' . $type . '">
1360 <div class="tnotice__icon">&iexcl;</div>
1361 <div class="tnotice__content">';
1362
1363 if ( $title ) {
1364 $output .= '<p class="tnotice__type">' . $title . '</p>';
1365 }
1366 $output .= '<p class="tnotice__message">' . $msg . '</p>
1367 </div>
1368 </div>';
1369
1370 return $output;
1371 }
1372 }
1373
1374 /**
1375 * @param int $course_content_id
1376 * @param bool $echo
1377 *
1378 * @return mixed|void
1379 *
1380 * Next Previous Pagination
1381 *
1382 * @since v.1.4.7
1383 */
1384
1385 function tutor_next_previous_pagination( $course_content_id = 0, $echo = true ) {
1386 $content_id = tutor_utils()->get_post_id( $course_content_id );
1387 $contents = tutor_utils()->get_course_prev_next_contents_by_id( $content_id );
1388 $previous_id = $contents->previous_id;
1389 $next_id = $contents->next_id;
1390
1391 ob_start();
1392 do_action( 'tutor_lesson_next_previous_pagination_before' );
1393 tutor_load_template( 'single.next-previous-pagination', compact( 'previous_id', 'next_id' ) );
1394 do_action( 'tutor_lesson_next_previous_pagination_after' );
1395 $output = apply_filters( 'tutor/single/next_previous_pagination', ob_get_clean() );
1396
1397 if ( $echo ) {
1398 echo tutor_kses_html( $output ); //phpcs:ignore -- already escaped inside template file
1399 }
1400
1401 return $output;
1402 }
1403
1404 /**
1405 * Load custom template from any given file
1406 *
1407 * Pass parameter as wish
1408 *
1409 * @since 1.9.8
1410 */
1411 if ( ! function_exists( 'tutor_load_template_from_custom_path' ) ) {
1412 function tutor_load_template_from_custom_path( $template = null, $data = array(), $once = true ) {
1413 do_action( 'tutor_load_template_from_custom_path_before', $template, $data );
1414 if ( file_exists( $template ) ) {
1415 if ( $once ) {
1416 include_once $template;
1417 } else {
1418 include $template;
1419 }
1420 }
1421 do_action( 'tutor_load_template_from_custom_path_after', $template, $data );
1422 }
1423 }
1424
1425 /**
1426 * Load enrolled course progress template
1427 *
1428 * This template will be used on only dashboard enrolled course page
1429 *
1430 * @since v2.0.0
1431 */
1432 if ( ! function_exists( 'tutor_enrolled_course_progress' ) ) {
1433 function tutor_enrolled_course_progress() {
1434 global $wp_query;
1435 $query_vars = $wp_query->query_vars;
1436 if ( isset( $query_vars['tutor_dashboard_page'] ) && 'enrolled-courses' === $query_vars['tutor_dashboard_page'] ) {
1437 tutor_load_template_from_custom_path( tutor()->path . 'templates/loop/enrolled-course-progress.php', '', false );
1438 }
1439 }
1440 }
1441