Created
October 29, 2021 06:11
-
-
Save ibrahim-kardi/dae6b925edc8aa818c847860cbc81e3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//need to replace 262-263 line with this code in the templates->course-course-list.php file | |
<div class="tutor-course-loop-price"> | |
<?php | |
$course_id = get_the_ID(); | |
$is_public = get_post_meta( $course_id, '_tutor_is_public_course', true )=='yes'; | |
$enroll_btn = '<div class="tutor-public-course-start-learning">' . apply_filters( 'tutor_course_restrict_new_entry', '<a href="'. get_the_permalink(). '">' . __('Get Enrolled', 'tutor') . '</a>' ) . '</div>'; | |
$default_price = apply_filters('tutor-loop-default-price', ($is_public ? '' : __('Free', 'tutor') )); | |
$free_html = '<div class="price"> '.$default_price.$enroll_btn. '</div>'; | |
if (tutor_utils()->is_course_purchasable()) { | |
$enroll_btn = tutor_course_loop_add_to_cart(false); | |
$product_id = tutor_utils()->get_course_product_id($course_id); | |
$product = wc_get_product( $product_id ); | |
if ( $product ) { | |
$price_html = '<div class="price"> '.$product->get_price_html() . apply_filters( 'tutor_course_restrict_new_entry', $enroll_btn ) . ' </div>'; | |
} | |
echo $price_html; | |
} else{ | |
echo $free_html; | |
} | |
?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment