Пример #1
0
<div>
	<?php 
do_action('learn_press_before_own_course_title');
the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
do_action('learn_press_after_own_course_title');
do_action('learn_press_before_own_course_price');
printf('<p class="course-price">%s</p>', __('Price', 'learn_press'), learn_press_get_course_price(get_the_ID(), true));
do_action('learn_press_after_own_course_price');
do_action('learn_press_before_student_enrolled');
printf('<p class="student-enrolled">%s: %d</p>', __('Students enrolled', 'learn_press'), learn_press_count_students_enrolled(get_the_ID()));
do_action('learn_press_after_student_enrolled');
do_action('learn_press_before_student_passed');
printf('<p class="student-passed">%s: %d</p>', __('Students passed', 'learn_press'), learn_press_count_students_passed(get_the_ID()));
do_action('learn_press_after_student_passed');
?>
</div>
Пример #2
0
<?php

/**
 * Template for displaying the students of a course
 */
learn_press_prevent_access_directly();
do_action('learn_press_before_course_students');
?>
<span class="course-students">
    <?php 
do_action('learn_press_begin_course_students');
?>
    <?php 
if ($count = learn_press_count_students_enrolled()) {
    ?>
        <?php 
    if (strtolower(learn_press_get_user_course_status()) == 'completed') {
        ?>
            <?php 
        if ($count == 1) {
            ?>
                <?php 
            _e('You enrolled', 'learn_press');
            ?>
            <?php 
        } else {
            ?>
            <?php 
            printf(_nx('You and one student enrolled', 'You and %1$s students enrolled', intval($count - 1), '', 'learn_press'), $count - 1);
            ?>
            <?php 
Пример #3
0
function learn_press_count_student_enrolled_course($course_id = null)
{
    return learn_press_count_students_enrolled($course_id);
}
Пример #4
0
/**
 * Shortcode to display paid course
 * @param  [type] $atts [description]
 * @return [type]       [description]
 */
function paid_courses_shortcode($atts)
{
    $a = shortcode_atts(array('number' => '1000000000'), $atts);
    wp_enqueue_style('learnpress-archive-course', LP_CSS_URL . '/shortcode-style/learnpress-archive-course.css');
    global $wpdb;
    $courses = $wpdb->get_results($wpdb->prepare("SELECT p.ID, pm.meta_value FROM {$wpdb->posts} AS p\n\t\t\tINNER JOIN {$wpdb->postmeta} AS pm ON p.ID = pm.post_id\n\t\t\tWHERE p.post_type = %s\n\t\t\tAND p.post_status = %s\n\t\t\tAND pm.meta_key = %s\n\t\t\tAND pm.meta_value = %s\n\t\t\tLIMIT %d", LP()->course_post_type, 'publish', '_lpr_course_payment', 'not_free', (int) $a['number']));
    foreach ($courses as $course) {
        ?>
	<a href="<?php 
        echo get_the_permalink($course->ID);
        ?>
">
		<div class="archive-course">
			<div class="course-cover"><?php 
        echo get_the_post_thumbnail($course->ID);
        ?>
</div>
			<div class="course-detail">
				<div class="course-title">
					<?php 
        echo get_the_title($course->ID);
        ?>
				</div>
				<div class="course-student-number"><?php 
        echo learn_press_count_students_enrolled($course->ID) . __(' students', 'learn_press');
        ?>
</div>
				<div class="course-lesson-number"><?php 
        echo lpr_get_number_lesson($course->ID) . __(' lessons', 'learn_press');
        ?>
</div>
			</div>
		</div>
	</a>
		<div class="clearfix"></div>
	<?php 
    }
}