1076 lines
46 KiB
PHP
1076 lines
46 KiB
PHP
<?php
|
|
|
|
// add_body_classes_for_tutor_lms
|
|
// upstudy_tutor_course_category
|
|
// upstudy_tutor_course_info
|
|
// upstudy_tutor_related_course_content
|
|
// upstudy_tutor_related_course_sidebar
|
|
// upstudy_tutor_course_page_title_section_03
|
|
// upstudy_tutor_course_page_title_section_04
|
|
// upstudy_tutor_course_page_title_section_05
|
|
// upstudy_tutor_course_page_title_section_06
|
|
// upstudy_tutor_course_page_title_section_07
|
|
// upstudy_tutor_course_page_title_section_08
|
|
// upstudy_tutor_course_page_title_section_09
|
|
|
|
/**
|
|
* Tutor LMS Compatibility
|
|
*
|
|
* @package Upstudy
|
|
*/
|
|
|
|
function add_body_classes_for_tutor_lms( $classes ) {
|
|
|
|
|
|
global $wp;
|
|
$prefix = '_upstudy_';
|
|
$post_id = upstudy_get_id();
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
$tutor_hide_profile_page_header = Upstudy::setting( 'tutor_hide_profile_page_header' );
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
|
|
// Get body class for tutor lms profile page
|
|
if (strpos( home_url($wp->request), '/profile/') !== false && function_exists('tutor') && $tutor_hide_profile_page_header == true ) {
|
|
$classes[] = 'upstudy_tutor_profile_page';
|
|
}
|
|
|
|
// Get body class for tutor lms profile page
|
|
if ( function_exists('tutor') && $tutor_single_page_layout && is_singular( 'courses' )) {
|
|
$classes[] = 'single-course-layout-0'.$tutor_single_page_layout.'';
|
|
}
|
|
|
|
// Get body class for tutor lms course excerpt
|
|
if ( function_exists('tutor') && $tutor_single_excerpt && is_singular( 'courses' )) {
|
|
$classes[] = 'has__excerpt';
|
|
}
|
|
|
|
// Get body class for tutor lms course meta
|
|
$has_meta = ( Upstudy::setting( 'tutor_instructor_single' ) || Upstudy::setting( 'tutor_single_wishlist' ) ) ? true : false;
|
|
|
|
if ( function_exists('tutor') && $has_meta && is_singular( 'courses' )) {
|
|
$classes[] = 'has__meta';
|
|
}
|
|
|
|
// Finally $classes return
|
|
return $classes;
|
|
|
|
|
|
}
|
|
add_filter( 'body_class', 'add_body_classes_for_tutor_lms' );
|
|
|
|
|
|
/**
|
|
* Display Course Category
|
|
*/
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_category' ) ) {
|
|
|
|
function upstudy_tutor_course_category() {
|
|
|
|
global $post;
|
|
$post_id = $post->ID;
|
|
|
|
?>
|
|
<!-- tutor Course Category -->
|
|
<div class="tutor__widget">
|
|
<section class="widget upstudy-course-widget">
|
|
<h2 class="widget-title"><?php esc_html_e('Course Categories', 'upstudy');?></h2>
|
|
<?php
|
|
|
|
$args = array(
|
|
'taxonomy' => 'course-category',
|
|
'orderby' => 'name',
|
|
'order' => 'ASC'
|
|
);
|
|
$terms = get_categories($args);
|
|
|
|
if ($terms && ! is_wp_error($terms)): ?>
|
|
<ul>
|
|
<?php foreach($terms as $term): ?>
|
|
<li><a href="<?php echo get_term_link( $term->slug, 'course-category'); ?>" rel="tag" class="<?php echo esc_attr($term->slug); ?>"><?php echo esc_html($term->name); ?></a></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
</section>
|
|
</div>
|
|
|
|
<?php
|
|
}
|
|
}
|
|
// ==== Display Course info / upstudy_tutor_course_info =====
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_info' ) ) {
|
|
|
|
function upstudy_tutor_course_info() {
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
$tutor_intro_video_position = Upstudy::setting( 'tutor_intro_video_position' );
|
|
$tutor_instructor_single = Upstudy::setting( 'tutor_instructor_single' );
|
|
$tutor_duration_single = Upstudy::setting( 'tutor_duration_single' );
|
|
$tutor_lesson_single = Upstudy::setting( 'tutor_lesson_single' );
|
|
$tutor_single_cat = Upstudy::setting( 'tutor_single_cat' );
|
|
$tutor_single_language = Upstudy::setting( 'tutor_single_language' );
|
|
$tutor_single_info_heading = Upstudy::setting( 'tutor_single_info_heading');
|
|
$tutor_custom_features_position = Upstudy::setting( 'tutor_custom_features_position' );
|
|
$tutor_single_price = Upstudy::setting( 'tutor_single_price' );
|
|
$tutor_single_enroll = Upstudy::setting( 'tutor_single_enroll' );
|
|
$tutor_single_enroll_btn = Upstudy::setting( 'tutor_single_enroll_btn' );
|
|
$tutor_single_skill_level = Upstudy::setting( 'tutor_single_skill_level' );
|
|
$tutor_single_quiz = Upstudy::setting( 'tutor_single_quiz' );
|
|
|
|
if ( !in_array( $tutor_single_page_layout, array('5')) ) {
|
|
//get_template_part( 'tutor/tpl-part/single/single', 'media' );
|
|
}
|
|
|
|
echo '<div class="upstudy-course-info">';
|
|
|
|
if ( !in_array( $tutor_single_page_layout, array('5')) ) {
|
|
echo '<h4 class="widget-title">' . esc_html__( 'Course Includes', 'upstudy' ) . '</h4>';
|
|
}
|
|
|
|
echo '<ul class="course-info-list">';
|
|
|
|
$course_id = get_the_ID();
|
|
$default_price = apply_filters('tutor-loop-default-price', esc_html__('Free', 'upstudy'));
|
|
$price_html = '<span class="price"> ' . $default_price . '</span>';
|
|
|
|
if ($tutor_single_price) {
|
|
echo '<li class="upstudy-price-meta">';
|
|
echo '<span class="label upstudy-price-label"><i class="dt-icon-price-label"></i>' . esc_html__('Price :', 'upstudy') . '</span>';
|
|
echo '<span class="value upstudy-price-value">';
|
|
|
|
$is_purchasable = tutor_utils()->is_course_purchasable();
|
|
$price = apply_filters( 'get_tutor_course_price', null, get_the_ID() );
|
|
if ( $is_purchasable && $price ) :
|
|
$price = $price;
|
|
else :
|
|
$price = esc_html__( 'Free', 'upstudy' );
|
|
endif;
|
|
|
|
echo wp_kses_post($price);
|
|
|
|
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
if ($tutor_custom_features_position == 'top') {
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'custom' );
|
|
}
|
|
|
|
$total_students = (int) tutor_utils()->count_enrolled_users_by_course();
|
|
$students_text = ('1' == $total_students) ? esc_html__(' Student', 'upstudy') : esc_html__(' Students', 'upstudy');
|
|
if ($tutor_single_enroll) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-friends"></i>' . esc_html__(' Enrolled :', 'upstudy') . '</span>';
|
|
echo '<span class="value">';
|
|
echo wp_kses_post($total_students);
|
|
echo wp_kses_post($students_text);
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
$total_lesson = tutor_utils()->get_lesson_count_by_course(get_the_ID());
|
|
$lesson_text = ('1' == $total_lesson) ? esc_html__(' Lesson', 'upstudy') : esc_html__(' Lessons', 'upstudy');
|
|
|
|
if ($tutor_lesson_single) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-book"></i>' . esc_html__('Lessons :', 'upstudy') . '</span>';
|
|
echo '<span class="value">';
|
|
echo wp_kses_post( $total_lesson );
|
|
echo wp_kses_post( $lesson_text );
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
$course_duration = get_tutor_course_duration_context();
|
|
if ($tutor_duration_single && !empty($course_duration)) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-clock"></i>' . esc_html__(' Duration :', 'upstudy') . '</span>';
|
|
echo '<span class="value">';
|
|
echo wp_kses_post($course_duration);
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
$total_questions = tutor_utils()->get_quiz_count_by_course( get_the_ID() );
|
|
$total_questions_text = ('1' == $total_questions) ? esc_html__(' Quiz', 'upstudy') : esc_html__(' Quizzes', 'upstudy');
|
|
|
|
if ($tutor_single_quiz) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-lightbulb"></i>' . esc_html__(' Quiz :', 'upstudy') . '</span>';
|
|
echo '<span class="value">';
|
|
echo wp_kses_post( $total_questions );
|
|
echo wp_kses_post( $total_questions_text );
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
if ($tutor_single_skill_level) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-signal"></i>' . esc_html__('Skill Level :', 'upstudy') . '</span>';
|
|
echo '<span class="value">' . get_tutor_course_level() . '</span>';
|
|
echo '</li>';
|
|
}
|
|
|
|
if ($tutor_single_cat) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-supermarket"></i>' . esc_html__('Category :', 'upstudy') . '</span>';
|
|
echo '<span class="tutor_course_cat value">';
|
|
if (!get_the_terms(get_the_ID(), 'course-category')) {
|
|
esc_html_e('Uncategorized', 'upstudy');
|
|
} else {
|
|
echo get_the_term_list(get_the_ID(), 'course-category', '');
|
|
}
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
if (function_exists('tutor')) {
|
|
if ( $tutor_single_language && !empty(get_the_terms(get_the_ID(), 'tutor_course_language'))) {
|
|
echo '<li>';
|
|
echo '<span class="label"><i class="meta-icon dt-icon-languages"></i>' . esc_html__('Language :', 'upstudy') . '</span>';
|
|
echo '<span class="language-tag value">';
|
|
echo get_the_term_list(get_the_ID(), 'tutor_course_language', '');
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
}
|
|
|
|
if ($tutor_custom_features_position == 'bottom') {
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'custom' );
|
|
}
|
|
|
|
if ($tutor_single_enroll_btn) {
|
|
tutor_load_template( 'single.course.course-entry-box' );
|
|
}
|
|
|
|
echo '</ul>';
|
|
echo '</div>';
|
|
|
|
}
|
|
}
|
|
/**
|
|
* Display related courses Content
|
|
*/
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_related_course_content' ) ) {
|
|
|
|
function upstudy_tutor_related_course_content( $postType = 'courses', $postID = null, $totalPosts = null, $relatedBy = null) {
|
|
|
|
$tutor_related_course_title = Upstudy::setting( 'tutor_related_course_title' );
|
|
$tutor_related_course_items = Upstudy::setting( 'tutor_related_course_items' );
|
|
$tutor_related_course_by = Upstudy::setting( 'tutor_related_course_by' );
|
|
$tutor_related_course_columns = Upstudy::setting( "tutor_related_course_columns" );
|
|
|
|
$args = array(
|
|
'style' => $style = Upstudy::setting( 'tutor_course_archive_style' )
|
|
);
|
|
|
|
global $post, $related_posts_custom_query_args;
|
|
if (null === $postID) $postID = $post->ID;
|
|
if (null === $totalPosts) $totalPosts = $tutor_related_course_items;
|
|
if (null === $relatedBy) $relatedBy = $tutor_related_course_by;
|
|
if (null === $postType) $postType = 'courses';
|
|
|
|
// Build our basic custom query arguments
|
|
|
|
if ($relatedBy === 'category') {
|
|
$categories = get_the_category( $post->ID );
|
|
$catidlist = '';
|
|
foreach( $categories as $category) {
|
|
$catidlist .= $category->cat_ID . ",";
|
|
}
|
|
// Build our category based custom query arguments
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
'cat' => $catidlist, // Select posts in the same categories as the current post
|
|
);
|
|
}
|
|
|
|
if ($relatedBy === 'tags') {
|
|
|
|
// Get the tags for the current post
|
|
$tags = wp_get_post_tags($postID);
|
|
// If the post has tags, run the related post tag query
|
|
if ($tags) {
|
|
$tag_ids = array();
|
|
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
|
|
// Build our tag related custom query arguments
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'tag__in' => $tag_ids, // Select posts with related tags
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
);
|
|
} else {
|
|
// If the post does not have tags, run the standard related posts query
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
// Initiate the custom query
|
|
$custom_query = new WP_Query( $related_posts_custom_query_args );
|
|
|
|
|
|
// Run the loop and output data for the results
|
|
if ( $custom_query->have_posts() ) :
|
|
|
|
echo '<div class="related-post-title-wrap">';
|
|
echo '<h3 class="related-title text-center">' . esc_html( $tutor_related_course_title ) . '</h3>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="upstudy-row">';
|
|
while ( $custom_query->have_posts() ) : $custom_query->the_post();
|
|
echo '<div class="upstudy-col-lg-'. esc_attr( $tutor_related_course_columns ). ' upstudy-col-sm-6">';
|
|
|
|
get_template_part( 'tutor/tpl-part/course/th-layouts', '', $args );
|
|
|
|
echo '</div>';
|
|
endwhile;
|
|
echo '</div>';
|
|
endif;
|
|
|
|
// Reset postdata
|
|
wp_reset_postdata();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Display related courses sidebar
|
|
*/
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_related_course_sidebar' ) ) {
|
|
|
|
function upstudy_tutor_related_course_sidebar( $postType = 'courses', $postID = null, $totalPosts = null, $relatedBy = null) {
|
|
|
|
$tutor_related_course_title = Upstudy::setting( 'tutor_related_course_title' );
|
|
$tutor_related_course_items = Upstudy::setting( 'tutor_related_course_items' );
|
|
$tutor_related_course_by = Upstudy::setting( 'tutor_related_course_by' );
|
|
$tutor_related_course_style = Upstudy::setting( 'tutor_related_course_style' );
|
|
$final_tutor_related_course_style = ($tutor_related_course_style == 'square') ? 'square' : 'round';
|
|
|
|
global $post, $related_posts_custom_query_args;
|
|
if (null === $postID) $postID = $post->ID;
|
|
if (null === $totalPosts) $totalPosts = $tutor_related_course_items;
|
|
if (null === $relatedBy) $relatedBy = $tutor_related_course_by;
|
|
if (null === $postType) $postType = 'courses';
|
|
|
|
// Build our basic custom query arguments
|
|
|
|
if ($relatedBy === 'category') {
|
|
$categories = get_the_category( $post->ID );
|
|
$catidlist = '';
|
|
foreach( $categories as $category) {
|
|
$catidlist .= $category->cat_ID . ",";
|
|
}
|
|
// Build our category based custom query arguments
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
'cat' => $catidlist, // Select posts in the same categories as the current post
|
|
);
|
|
}
|
|
|
|
if ($relatedBy === 'tags') {
|
|
|
|
// Get the tags for the current post
|
|
$tags = wp_get_post_tags($postID);
|
|
// If the post has tags, run the related post tag query
|
|
if ($tags) {
|
|
$tag_ids = array();
|
|
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
|
|
// Build our tag related custom query arguments
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'tag__in' => $tag_ids, // Select posts with related tags
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
);
|
|
} else {
|
|
// If the post does not have tags, run the standard related posts query
|
|
$related_posts_custom_query_args = array(
|
|
'post_type' => $postType,
|
|
'posts_per_page' => $totalPosts, // Number of related posts to display
|
|
'post__not_in' => array($postID), // Ensure that the current post is not displayed
|
|
'orderby' => 'rand', // Randomize the results
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
// Initiate the custom query
|
|
$custom_query = new WP_Query( $related_posts_custom_query_args );
|
|
|
|
|
|
// Run the loop and output data for the results
|
|
if ( $custom_query->have_posts() ) : ?>
|
|
|
|
<section id="pxcv-tutor-course-2" class="widget upstudy-course-widget widget_pxcv_posts style__<?php echo esc_attr($final_tutor_related_course_style); ?>">
|
|
<h2 class="widget-title"><?php echo esc_html__('Related Courses', 'upstudy'); ?></h2>
|
|
<ul class="pxcv-rr-item-widget">
|
|
|
|
<?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
|
|
<li class="clearfix has_image">
|
|
|
|
<?php if ( has_post_thumbnail() ) : ?>
|
|
|
|
<a class="post__link" href="<?php the_permalink(); ?>">
|
|
<div class="pxcv-rr-item-image_wrapper">
|
|
<?php the_post_thumbnail( 'thumbnail' ); ?>
|
|
</div>
|
|
</a>
|
|
|
|
<?php endif; ?>
|
|
|
|
<div class="pxcv-rr-item-content_wrapper">
|
|
<a class="post__link" href="<?php the_permalink(); ?>">
|
|
<h6 class="post__title"><?php the_title(); ?></h6>
|
|
</a>
|
|
<span class="course-price">
|
|
|
|
<span class="price">
|
|
<?php get_template_part( 'tutor/tpl-part/price'); ?>
|
|
</span>
|
|
|
|
</span>
|
|
</div>
|
|
</li>
|
|
<?php endwhile; ?>
|
|
|
|
</ul>
|
|
</section>
|
|
|
|
<?php endif;
|
|
// Reset postdata
|
|
wp_reset_postdata();
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Course page title section upstudy_tutor_course_page_title_section_02
|
|
*/
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_02' ) ) :
|
|
function upstudy_tutor_course_page_title_section_02( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_review = Upstudy::setting( 'tutor_single_review' );
|
|
$tutor_single_last_update = Upstudy::setting( 'tutor_single_last_update' );
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
|
|
$tutor_header_color = ( $tutor_single_page_layout == '4' ) ? 'light' : 'dark' ;
|
|
$tutor_single_title_tag = Upstudy::setting( 'tutor_single_title_tag' );
|
|
$header_page_title_align = Upstudy::setting( 'header_page_title_align' );
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
echo '<div class="upstudy-page-title-area upstudy-default-breadcrumb '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-course-top-info">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
echo '<div class="upstudy-breadcrumb-wrapper has-text-align-left">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
}
|
|
echo '<div class="upstudy-page-title">';
|
|
|
|
if ( $tutor_single_review ) :
|
|
|
|
$course_rating = tutor_utils()->get_course_rating( get_the_ID() );
|
|
|
|
echo '<div class="upstudy-rating-wrap">';
|
|
|
|
echo '<span class="upstudy-ratings-stars">';
|
|
echo tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, false, '', 'lg' );
|
|
echo '</span>';
|
|
|
|
echo '<span class="upstudy-ratings-total">';
|
|
$total_text = ('1' == $course_rating) ? esc_html__(' Rating', 'upstudy') : esc_html__(' Ratings', 'upstudy');
|
|
echo esc_attr(' (');
|
|
echo esc_html( $course_rating->rating_count > 0 ? $course_rating->rating_count : 0 );
|
|
echo esc_html($total_text);
|
|
echo esc_attr(')');
|
|
echo '</span>';
|
|
|
|
echo '</div>'; // End .upstudy-rating-wrap
|
|
|
|
endif;
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="page-title has-text-align-left">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="page-title">';
|
|
|
|
echo '</div>';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text has-text-align-left">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
upstudy_breadcrumb_shapes();
|
|
|
|
// get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
// ===== upstudy_tutor_course_page_title_section_03
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_03' ) ) :
|
|
function upstudy_tutor_course_page_title_section_03( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
$tutor_header_color = ( $tutor_single_page_layout == '4' ) ? 'light' : 'dark' ;
|
|
|
|
echo '<div class="upstudy-course-top-info upstudy-page-title-area upstudy-breadcrumb-style-1 '. esc_attr( $tutor_header_color ).'">';
|
|
echo '<div class="upstudy-container">';
|
|
echo '<div class="upstudy-row">';
|
|
echo '<div class="upstudy-col-lg-8">';
|
|
echo '<div class="upstudy-single-course-lead-info ld">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="course-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="course-title">';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
// get_template_part( 'tutor/tpl-part/single/meta', 'review-update' );
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
|
|
echo '</div>';
|
|
echo '<div class="upstudy-col-lg-4"></div>';
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
}
|
|
endif;
|
|
|
|
|
|
/**
|
|
* Course page title section upstudy_tutor_course_page_title_section_05
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_05' ) ) :
|
|
function upstudy_tutor_course_page_title_section_05( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_review = Upstudy::setting( 'tutor_single_review' );
|
|
$tutor_single_last_update = Upstudy::setting( 'tutor_single_last_update' );
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
|
|
$tutor_header_color = ( $tutor_single_page_layout == '4' ) ? 'light' : 'dark' ;
|
|
$tutor_single_title_tag = Upstudy::setting( 'tutor_single_title_tag' );
|
|
$header_page_title_align = Upstudy::setting( 'header_page_title_align' );
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
echo '<div class="upstudy-page-title-area upstudy-default-breadcrumb '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-course-top-info">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
echo '<div class="upstudy-breadcrumb-wrapper has-text-align-'.$header_page_title_align.'">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
}
|
|
echo '<div class="upstudy-page-title">';
|
|
|
|
// echo '<div class="upstudy-post-cat">';
|
|
// if (!get_the_terms(get_the_ID(), 'course-category')) {
|
|
// esc_html_e('Uncategorized', 'upstudy');
|
|
// } else {
|
|
// echo get_the_term_list(get_the_ID(), 'course-category', '');
|
|
// }
|
|
// echo '</div>';
|
|
|
|
if ( $tutor_single_review ) :
|
|
$course_rating = tutor_utils()->get_course_rating( get_the_ID() );
|
|
echo '<div class="upstudy-rating-wrap">';
|
|
|
|
echo '<span class="upstudy-ratings-stars">';
|
|
echo tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, false, '', 'lg' );
|
|
echo '</span>';
|
|
|
|
echo '<span class="upstudy-ratings-total">';
|
|
$total_text = ('1' == $course_rating) ? esc_html__(' Rating', 'upstudy') : esc_html__(' Ratings', 'upstudy');
|
|
echo esc_attr(' (');
|
|
echo esc_html( $course_rating->rating_count > 0 ? $course_rating->rating_count : 0 );
|
|
echo esc_html($total_text);
|
|
echo esc_attr(')');
|
|
echo '</span>';
|
|
|
|
echo '</div>'; // End .upstudy-rating-wrap
|
|
endif;
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="page-title has-text-align-'.$header_page_title_align.'">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="page-title">';
|
|
echo '</div>';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
upstudy_breadcrumb_shapes();
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
// ===== upstudy_tutor_course_page_title_section_04 ====
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_04' ) ) :
|
|
function upstudy_tutor_course_page_title_section_04( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
global $post; $post_id = $post->ID;
|
|
$course_id = $post_id;
|
|
$user_id = get_current_user_id();
|
|
$current_id = $post->ID;
|
|
$prefix = '_upstudy_';
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_review = Upstudy::setting( 'tutor_single_review' );
|
|
$tutor_single_last_update = Upstudy::setting( 'tutor_single_last_update' );
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
|
|
$tutor_header_color = ( $tutor_single_page_layout == '4' ) ? 'light' : 'dark' ;
|
|
|
|
$page_header_img = get_post_meta($post_id, $prefix . 'header_img', true);
|
|
|
|
$tutor_intro_video_position = Upstudy::setting( 'tutor_intro_video_position' );
|
|
$tutor_single_social_shear = Upstudy::setting( 'tutor_single_social_shear ' );
|
|
|
|
$breadcrumb_show = Upstudy::setting( 'breadcrumb_show' );
|
|
$shortcode_breadcrumb = Upstudy::setting( 'shortcode_breadcrumb' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
|
|
$custom_page_header_img = get_post_meta( get_the_ID(), '_upstudy_header_img', 1 );
|
|
|
|
$page_title_image_sourse = ( !empty( $custom_page_header_img )) ? $custom_page_header_img : get_header_image() ;
|
|
|
|
echo '<div style="background-image: url('.$page_title_image_sourse.')" class="upstudy-course-top-info upstudy-page-title-area upstudy-breadcrumb-style-1 '.$tutor_header_color.'">';
|
|
echo '<div class="upstudy-container">';
|
|
echo '<div class="upstudy-row">';
|
|
|
|
echo '<div class="upstudy-col-lg-4">';
|
|
if ( $tutor_single_page_layout == '5' ) {
|
|
get_template_part( 'tutor/tpl-part/single/media', 'header' );
|
|
}
|
|
echo '</div>'; // End upstudy-col-lg-4
|
|
|
|
|
|
echo '<div class="upstudy-col-lg-8">';
|
|
echo '<div class="upstudy-single-course-lead-info tutor">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="course-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="course-title">';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>'; // End upstudy-single-course-lead-info
|
|
|
|
echo '</div>'; // End upstudy-col-lg-8
|
|
|
|
|
|
echo '</div>'; // End upstudy-row
|
|
echo '</div>'; // End upstudy-container
|
|
echo '</div>'; // End upstudy-course-top-info
|
|
|
|
}
|
|
endif;
|
|
|
|
// ===== upstudy_tutor_course_page_title_section_06
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_06' ) ) :
|
|
function upstudy_tutor_course_page_title_section_06( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$custom_page_header_img = get_post_meta( get_the_ID(), '_upstudy_header_img', 1 );
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
echo '<div style="background-image: url('.$custom_page_header_img.')" class="upstudy-page-title-area upstudy-breadcrumb-style-1 upstudy-breadcrumb-has-bg '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-course-top-info">';
|
|
echo '<div class="upstudy-page-title">';
|
|
echo '<'.$tutor_single_title_tag.' class="entry-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="entry-title">';
|
|
echo '</div>';
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
// ===== upstudy_tutor_course_page_title_section_07
|
|
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_07' ) ) :
|
|
function upstudy_tutor_course_page_title_section_07( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$custom_page_header_img = get_post_meta( get_the_ID(), '_upstudy_header_img', 1 );
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
echo '<div style="background-image: url('.$custom_page_header_img.')" class="upstudy-page-title-area upstudy-breadcrumb-style-1 upstudy-breadcrumb-has-bg '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-course-top-info">';
|
|
echo '<div class="upstudy-page-title">';
|
|
echo '<'.$tutor_single_title_tag.' class="entry-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="entry-title">';
|
|
echo '</div>';
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* Course page title section upstudy_tutor_course_page_title_section_08
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_08' ) ) :
|
|
function upstudy_tutor_course_page_title_section_08( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_review = Upstudy::setting( 'tutor_single_review' );
|
|
$tutor_single_last_update = Upstudy::setting( 'tutor_single_last_update' );
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
|
|
$tutor_header_color = 'upstudy-dark-header';
|
|
$tutor_single_title_tag = Upstudy::setting( 'tutor_single_title_tag' );
|
|
$header_page_title_align = 'left';
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
|
|
echo '<div class="upstudy-page-title-area '. esc_attr( $tutor_header_color ) .' '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-row">';
|
|
echo '<div class="upstudy-col-sm-8">';
|
|
|
|
echo '<div class="upstudy-single-course-lead-info tutor has-text-align-'.$header_page_title_align.'"">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="course-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="course-title">';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>'; // End upstudy-single-course-lead-info
|
|
|
|
echo '</div>';
|
|
echo '<div class="upstudy-col-sm-4">';
|
|
echo '<div class="upstudy-course-info-03">';
|
|
|
|
tutor_load_template( 'single.course.course-entry-box' );
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* Course page title section upstudy_tutor_course_page_title_section_09
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_09' ) ) :
|
|
function upstudy_tutor_course_page_title_section_09( $title = null, $has_bg_image = null, $extra_style = null ) {
|
|
|
|
$tutor_single_excerpt = Upstudy::setting( 'tutor_single_excerpt' );
|
|
$tutor_single_review = Upstudy::setting( 'tutor_single_review' );
|
|
$tutor_single_last_update = Upstudy::setting( 'tutor_single_last_update' );
|
|
|
|
$tutor_single_page_layout = Upstudy::setting( 'tutor_single_page_layout' );
|
|
|
|
$tutor_header_color = 'upstudy-dark-header';
|
|
$tutor_single_title_tag = Upstudy::setting( 'tutor_single_title_tag' );
|
|
$header_page_title_align = 'left';
|
|
$tutor_course_header_style = Upstudy::setting( 'tutor_course_header_style' );
|
|
$tutor_single_breadcrumb = Upstudy::setting( 'tutor_single_breadcrumb' );
|
|
|
|
|
|
echo '<div class="upstudy-page-title-area '. esc_attr( $tutor_header_color ) .' '. esc_attr( $has_bg_image ) . 'course-header-style--' . $tutor_course_header_style .'"' . $extra_style .'>';
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-row">';
|
|
echo '<div class="upstudy-col-sm-8">';
|
|
|
|
echo '<div class="upstudy-single-course-lead-info tutor has-text-align-'.$header_page_title_align.'"">';
|
|
|
|
if ( $tutor_single_breadcrumb ) {
|
|
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo '<'.$tutor_single_title_tag.' class="course-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="course-title">';
|
|
|
|
if ( $tutor_single_excerpt) :
|
|
echo '<div class="course-short-text">';
|
|
the_excerpt();
|
|
echo '</div>';
|
|
endif;
|
|
|
|
get_template_part( 'tutor/tpl-part/single/meta', 'top' );
|
|
|
|
echo '</div>'; // End upstudy-single-course-lead-info
|
|
|
|
echo '</div>';
|
|
echo '<div class="upstudy-col-sm-4">';
|
|
echo '<div class="upstudy-course-info-03">';
|
|
|
|
get_template_part( 'tutor/tpl-part/single/media', 'content' );
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* upstudy_tutor_course_page_title_section_10
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_page_title_section_10' ) ) :
|
|
function upstudy_tutor_course_page_title_section_10( $title = null, $extra_style = null ) {
|
|
|
|
$breadcrumb_show = Upstudy::setting( 'breadcrumb_show' ) ?: true;
|
|
|
|
|
|
$bg_meta_image = get_post_meta( get_the_ID(), '_upstudy_header_img', true );
|
|
$bg_meta_color = get_post_meta( get_the_ID(), '_upstudy_page_title_bg_color', true );
|
|
$bg_framework_image = get_header_image();
|
|
$bg_framework_color = Upstudy::setting( 'header_banner_overlay_color' ) ?: 'header_image';
|
|
|
|
if ( $bg_meta_color ) :
|
|
$style[] = 'background-color:' . $bg_meta_color;
|
|
elseif ( $bg_framework_color ) :
|
|
$style[] = 'background-color:' . $bg_framework_color;
|
|
endif;
|
|
|
|
if ( $bg_meta_image ) :
|
|
$style[] = 'background-image:url(\''.esc_url( $bg_meta_image ).'\' )';
|
|
$has_bg_image = 'upstudy-breadcrumb-has-bg';
|
|
elseif ( ! $default_breadcrumb_at_page ) :
|
|
$breadcrumb_img = get_header_image();
|
|
if ( isset( $breadcrumb_img['url'] ) && ! empty( $breadcrumb_img['url'] ) ) :
|
|
$style[] = 'background-image:url(\'' . esc_url( $breadcrumb_img['url'] ) . '\' )';
|
|
$has_bg_image = 'upstudy-breadcrumb-has-bg';
|
|
endif;
|
|
endif;
|
|
|
|
echo '<div class="upstudy-page-title-area upstudy-breadcrumb-style-1 '. esc_attr( $has_bg_image ) .'"' . $extra_style .'>';
|
|
echo '<div class="' . esc_attr( apply_filters( 'upstudy_breadcrumb_container_class', 'upstudy-container' ) ) . '">';
|
|
|
|
echo '<div class="upstudy-page-title">';
|
|
echo '<'.$tutor_single_title_tag.' class="entry-title">';
|
|
the_title();
|
|
echo '</'.$tutor_single_title_tag.' class="entry-title">';
|
|
echo '</div>';
|
|
|
|
if ($breadcrumb_show) {
|
|
echo '<div class="upstudy-breadcrumb-wrapper">';
|
|
do_action( 'upstudy_breadcrumb' );
|
|
echo '</div>';
|
|
}
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
}
|
|
endif;
|
|
// ====== Old existing functions
|
|
|
|
/**
|
|
* Course Search Post Type
|
|
*/
|
|
add_filter( 'upstudy_course_search_post_type', 'upstudy_tl_course_search_post_type' );
|
|
if ( ! function_exists( 'upstudy_tl_course_search_post_type' ) ) :
|
|
function upstudy_tl_course_search_post_type() {
|
|
return 'courses';
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* Generate wishlist icon
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_wishlist_icon' ) ) :
|
|
function upstudy_tutor_wishlist_icon( $course_id ) {
|
|
|
|
$course_id = get_the_ID();
|
|
$is_wish_listed = tutor_utils()->is_wishlisted( $course_id );
|
|
|
|
$login_url_attr = '';
|
|
$action_class = '';
|
|
|
|
if ( is_user_logged_in() ) {
|
|
$action_class = apply_filters( 'tutor_wishlist_btn_class', 'tutor-course-wishlist-btn' );
|
|
} else {
|
|
$action_class = apply_filters( 'tutor_popup_login_class', 'tutor-open-login-modal' );
|
|
|
|
if ( ! tutor_utils()->get_option( 'enable_tutor_native_login', null, true, true ) ) {
|
|
$login_url_attr = 'data-login_url="' . esc_url( wp_login_url() ) . '"';
|
|
}
|
|
}
|
|
|
|
//phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- $login_url_attr contain safe data
|
|
echo '<a href="javascript:;" ' . $login_url_attr . ' class="' . esc_attr( $action_class ) . ' save-bookmark-btn tutor-iconic-btn tutor-iconic-btn-secondary" data-course-id="' . esc_attr( $course_id ) . '">
|
|
<i class="' . ( $is_wish_listed ? 'tutor-icon-bookmark-bold' : 'tutor-icon-bookmark-line' ) . '"></i>
|
|
</a>';
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* Sale tag for promotional courses
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_sale_tag' ) ) :
|
|
function upstudy_tutor_course_sale_tag() {
|
|
$course_price = tutor_utils()->get_raw_course_price( get_the_ID() );
|
|
$regular_price = $course_price->regular_price;
|
|
$sale_price = $course_price->sale_price;
|
|
if ( empty( $sale_price ) ) :
|
|
return;
|
|
endif;
|
|
if ( $regular_price != $sale_price ) :
|
|
printf( '<span class="label">%s</span>', apply_filters( 'upstudy_course_sale_tag_text', __( 'Sale', 'upstudy' ) ) );
|
|
endif;
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* post_class extends for tutor courses
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
if ( ! function_exists( 'upstudy_tutor_course_class' ) ) :
|
|
function upstudy_tutor_course_class( $default = array() ) {
|
|
$terms = get_the_terms( get_the_ID(), 'course-category' );
|
|
$terms_html = array();
|
|
if ( $terms ) :
|
|
foreach ( $terms as $term ) :
|
|
$terms_html[] = $term->slug;
|
|
endforeach;
|
|
endif;
|
|
$all_classes = array_merge( $terms_html, $default );
|
|
$classes = apply_filters( 'upstudy_tutor_course_class', $all_classes );
|
|
post_class( $classes );
|
|
}
|
|
endif;
|
|
|