| Server IP : 178.63.100.251 / Your IP : 216.73.216.228 Web Server : LiteSpeed System : Linux dobby.thevpsserver.com 4.18.0-553.16.1.lve.el8.x86_64 #1 SMP Tue Aug 13 17:45:03 UTC 2024 x86_64 User : truewayi ( 1855) PHP Version : 7.4.33 Disable Function : show_source,system,shell_exec,passthru,exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/truewayi/public_html/wp-content/themes/omexo/learndash/ |
Upload File : |
<?php
/**
* LearnDash Course Template Override
* Template Name: Custom Course Template
*/
if (!defined('ABSPATH')) exit;
get_header();
?>
<div class="container">
<div class="row">
<!-- Course Content -->
<div class="col-md-8">
<?php while (have_posts()) : the_post(); ?>
<div class="course-content">
<div class="course-description">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?>
</div>
<!-- Right Sidebar -->
<div class="col-md-4">
<div class="course-sidebar">
<?php
$course_id = get_the_ID();
// Get Course Price & Type
$course_meta = get_post_meta($course_id, '_sfwd-courses', true);
$course_price_type = isset($course_meta['sfwd-courses_course_price_type']) ? $course_meta['sfwd-courses_course_price_type'] : '';
$course_price = isset($course_meta['sfwd-courses_course_price']) ? $course_meta['sfwd-courses_course_price'] : 'Free';
// Handle price display
$price_display = ($course_price_type === 'free' || empty($course_price) || $course_price == '0') ? 'Free' : $course_price;
// Get Course Purchase URL
$purchase_url = '';
if ($course_price_type === 'paynow' || $course_price_type === 'subscribe') {
// If WooCommerce is used for LearnDash, get the WooCommerce product link
$purchase_url = learndash_get_course_access_url($course_id);
}
// Instructor (Author)
$instructor_id = get_post_field('post_author', $course_id);
$instructor_name = get_the_author_meta('display_name', $instructor_id);
// Course Duration
$course_duration = learndash_get_setting($course_id, 'course_duration');
$course_duration = !empty($course_duration) ? $course_duration : 'Not specified';
// Number of Lessons
$lesson_list = learndash_get_lesson_list($course_id);
$lesson_count = is_array($lesson_list) ? count($lesson_list) : 0;
// Number of Enrolled Students
$enrolled_users = learndash_get_users_for_course($course_id);
$course_students = !empty($enrolled_users) && is_array($enrolled_users) ? count($enrolled_users) : 0;
// Certification (Yes/No)
$certificate_enabled = learndash_get_setting($course_id, 'certificate');
$certification_status = !empty($certificate_enabled) ? 'Yes' : 'No';
// Course Language (Custom field)
$course_language = get_post_meta($course_id, 'course_language', true);
$course_language = !empty($course_language) ? $course_language : 'Not specified';
?>
<!-- Course Price & Purchase Button -->
<div class="course-pricing">
<h4>Price: <span><?php echo esc_html($price_display); ?></span></h4>
<?php if (!empty($purchase_url)) : ?>
<a href="<?php echo esc_url($purchase_url); ?>" class="btn btn-primary">Enroll Now</a>
<?php endif; ?>
</div>
<div class="course-promo-video">
<div class="video-wrapper">
<iframe width="100%" height="230" src="https://www.youtube.com/embed/yGDwk4z9EEg" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<ul class="course-meta">
<li><span>Instructor:</span> <?php echo esc_html($instructor_name); ?></li>
<li><strong>Duration:</strong> <?php echo esc_html($course_duration); ?></li>
<li><strong>Lessons:</strong> <?php echo esc_html($lesson_count); ?> <?php echo ($lesson_count == 1) ? 'Lesson' : 'Lessons'; ?></li>
<li><strong>Students:</strong> <?php echo esc_html($course_students); ?> <?php echo ($course_students == 1) ? 'Student' : 'Students'; ?></li>
<li><strong>Certification:</strong> <?php echo esc_html($certification_status); ?></li>
<li><strong>Language:</strong> <?php echo esc_html($course_language); ?></li>
</ul>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>