<?php

if ($courses->have_posts()) {
    ?>
	<?php 
    $columns = isset($atts['columns']) ? intval($atts['columns']) : 1;
    $classes = apply_filters('ib_educator_courses_list_classes', array('ib-edu-courses-list', 'ib-edu-courses-list-' . $columns));
    ?>
	<div class="<?php 
    echo esc_attr(implode(' ', $classes));
    ?>
">
		<?php 
    while ($courses->have_posts()) {
        $courses->the_post();
        Edr_View::template_part('content', 'course');
    }
    ?>
	</div>

	<?php 
    wp_reset_postdata();
    ?>

	<?php 
    if (!isset($atts['nopaging']) || 1 != $atts['nopaging']) {
        ?>
		<div class="ib-edu-pagination">
			<?php 
        $big = 999999999;
        echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, $args['paged']), 'total' => $courses->max_num_pages));
<?php 
get_header('ibeducator');
?>

<?php 
/**
 * Add HTML before output of educator's content.
 */
do_action('ib_educator_before_main_loop');
?>

<?php 
while (have_posts()) {
    the_post();
    Edr_View::template_part('content', 'single-lesson');
}
?>

<?php 
/**
 * Add HTML after output of educator's content.
 */
do_action('ib_educator_after_main_loop');
?>

<?php 
/**
 * Add sidebar.
 */
do_action('ib_educator_sidebar');
Beispiel #3
0
    /**
     * Display lessons of a given course.
     *
     * @param int $course_id
     */
    function edr_display_lessons($course_id)
    {
        $syllabus = get_post_meta($course_id, '_edr_syllabus', true);
        if (is_array($syllabus) && !empty($syllabus)) {
            $lesson_ids = array();
            $lessons = array();
            foreach ($syllabus as $group) {
                if (!empty($group['lessons'])) {
                    $lesson_ids = array_merge($lesson_ids, $group['lessons']);
                }
            }
            if (!empty($lesson_ids)) {
                $tmp = get_posts(array('post_type' => 'ib_educator_lesson', 'post__in' => $lesson_ids, 'post_status' => 'publish', 'posts_per_page' => count($lesson_ids)));
                foreach ($tmp as $lesson) {
                    $lessons[$lesson->ID] = $lesson;
                }
                unset($tmp);
            }
            Edr_View::the_template('course/syllabus', array('syllabus' => $syllabus, 'lessons' => $lessons));
        } else {
            $query = IB_Educator::get_instance()->get_lessons($course_id);
            if ($query && $query->have_posts()) {
                ?>
			<section class="ib-edu-lessons">
				<h2><?php 
                _e('Lessons', 'ibeducator');
                ?>
</h2>
				<?php 
                while ($query->have_posts()) {
                    $query->the_post();
                    Edr_View::template_part('content', 'lesson');
                }
                wp_reset_postdata();
                ?>
			</section>
		<?php 
            }
        }
    }
<?php

/**
 * Renders the [memberships_page] shortcode.
 *
 * @version 1.1.0
 */
$query = new WP_Query(array('post_type' => 'ib_edu_membership', 'posts_per_page' => -1, 'post_status' => 'publish', 'order' => 'ASC', 'orderby' => 'menu_order'));
if ($query->have_posts()) {
    $tmp_more = $GLOBALS['more'];
    $GLOBALS['more'] = 0;
    ?>
	<div class="ib-edu-memberships">
	<?php 
    while ($query->have_posts()) {
        $query->the_post();
        Edr_View::template_part('content', 'membership');
    }
    ?>
	</div>
	<?php 
    $GLOBALS['more'] = $tmp_more;
    wp_reset_postdata();
} else {
    echo '<p>' . __('No memberships found.', 'ibeducator') . '</p>';
}
>
	<h1 class="lesson-title entry-title"><?php 
the_title();
?>
</h1>

	<div id="ib-edu-breadcrumbs"><?php 
ib_edu_breadcrumbs();
?>
</div>

	<div class="lesson-content entry-content">
		<?php 
if ($student_can_study) {
    the_content();
    Edr_View::template_part('quiz');
} else {
    echo '<p>';
    printf(__('Please register for the %s to view this lesson.', 'ibeducator'), '<a href="' . esc_url(get_permalink(ib_edu_get_course_id())) . '">' . __('course', 'ibeducator') . '</a>');
    echo '</p>';
}
?>
	</div>

	<nav class="ib-edu-lesson-nav">
		<?php 
echo ib_edu_get_adjacent_lesson_link('previous', '<div class="nav-previous">&laquo; %link</div>', __('Previous Lesson', 'ibeducator'));
echo ib_edu_get_adjacent_lesson_link('next', '<div class="nav-next">%link &raquo;</div>', __('Next Lesson', 'ibeducator'));
?>
	</nav>
</article>
    ?>
						<section class="widget ib-edu-lessons">
							<h3 class="widget-title font-size-xs separator_align_left"><span><?php 
    esc_html_e('Practice', 'training');
    ?>
</span></h3>
							<div class="less-content <?php 
    if ($lessons_query->found_posts > 4) {
        echo 'content-hidden';
    }
    ?>
">
								<?php 
    while ($lessons_query->have_posts()) {
        $lessons_query->the_post();
        Edr_View::template_part('content', 'lesson');
    }
    wp_reset_postdata();
    ?>
							</div>
							<?php 
    if ($lessons_query->found_posts > 4) {
        ?>
								<div class="btn-view-lesson"><a><?php 
        esc_html_e('View more lessons', 'training');
        ?>
</a></div>
							<?php 
    }
    ?>