$result = wp_cache_get($course_key, 'course_loop'); } else { $result = false; } if (false === $result) { ob_start(); ?> <div class="item-avatar" itemprop="photo"> <?php bp_course_avatar(); ?> </div> <div class="item"> <div class="item-title" itemprop="itemreviewed"><?php bp_course_title(); if (get_post_status() != 'publish') { echo '<i> ( ' . get_post_status() . ' ) </i>'; } ?> </div> <div class="item-meta"><?php bp_course_meta(); ?> </div> <div class="item-desc"><?php bp_course_desc(); ?> </div> <div class="item-credits"> <?php
function bp_course_item_view() { $filter = apply_filters('bp_course_single_item_view', 0); if ($filter) { return; } $course_classes = apply_filters('bp_course_single_item', 'course_single_item', get_the_ID()); ?> <li class="<?php echo $course_classes; ?> "> <div class="item-avatar" data-id="<?php echo get_the_ID(); ?> "> <?php bp_course_avatar(); ?> </div> <div class="item"> <div class="item-title"><?php bp_course_title(); if (get_post_status() != 'publish') { echo '<i> ( ' . get_post_status() . ' ) </i>'; } ?> </div> <div class="item-meta"><?php bp_course_meta(); ?> </div> <div class="item-desc"><?php bp_course_desc(); ?> </div> <div class="item-credits"> <?php bp_course_credits(); ?> </div> <div class="item-instructor"> <?php bp_course_instructor(); ?> </div> <div class="item-action"><?php bp_course_action(); ?> </div> <?php do_action('bp_directory_course_item'); ?> </div> <div class="clear"></div> </li> <?php }
function bp_course_single_item_view($flag) { $course_classes = apply_filters('bp_course_single_item', 'modern_course_single_item', get_the_ID()); ?> <li class="<?php echo $course_classes; ?> "> <div class="row"> <div class="col-md-4"> <div class="item-avatar" data-id="<?php echo get_the_ID(); ?> " itemprop="photo"> <?php bp_course_avatar(); ?> </div> </div> <div class="col-md-6"> <div class="item-title"> <?php bp_course_title(); if (get_post_status() != 'publish') { echo '<i> ( ' . get_post_status() . ' ) </i>'; } ?> </div> <div class="item-desc"><?php echo get_the_term_list(get_the_ID(), 'course-cat', '<ul class="course-category"><li>', '</li><li>', '</li></ul>'); bp_course_desc(); $instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', get_the_ID()), get_the_ID()); if (!is_array($instructors)) { $instructors = array($instructors); } echo '<div class="instructors">'; foreach ($instructors as $instructor) { echo '<a href="' . bp_core_get_user_domain($instructor) . '" title="' . bp_core_get_username($instructor) . '">' . bp_core_fetch_avatar(array('item_id' => $instructor, 'type' => 'thumb')) . '</a>'; } ?> </div></div> </div> <div class="col-md-2"> <div class="course-meta"> <?php $reviews = get_post_meta(get_the_ID(), 'average_rating', true); $students = get_post_meta(get_the_ID(), 'vibe_students', true); $seats = get_post_meta(get_the_ID(), 'vibe_max_students', true); $date = get_post_meta(get_the_ID(), 'vibe_start_date', true); $duration = get_post_meta(get_the_ID(), 'vibe_duration', true); $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400); echo '<ul> <li><span class="dashicons dashicons-groups"></span> ' . $students . (empty($seats) || $seats > 9998 ? '' : ' / ' . $seats) . '</li> <li><span class="dashicons dashicons-clock"></span> ' . ($duration > 9998 ? __('UNLIMITED', 'wplms_modern') : $duration . ' ' . calculate_duration_time($course_duration_parameter)) . '</li>'; if (strtotime($date) > time()) { echo '<li>' . date_i18n(get_option('date_format'), strtotime($date)) . '</li>'; } echo '</ul><div class="modern-star-rating">'; for ($i = 1; $i <= 5; $i++) { if ($reviews >= 1) { echo '<span class="dashicons dashicons-star-filled"></span>'; } elseif ($reviews < 1 && $reviews >= 0.4) { echo '<span class="dashicons dashicons-star-half"></span>'; } else { echo '<span class="dashicons dashicons-star-empty"></span>'; } $reviews--; } echo '</div>'; ?> <div class="item-credits"> <?php bp_course_credits(); ?> </div> </div> </div> <?php do_action('bp_directory_course_item'); ?> </div> </li> <?php return 1; }
function child_course_filter() { global $bp; $args = array('post_type' => BP_COURSE_CPT); if (isset($_POST['filter'])) { $filter = $_POST['filter']; switch ($filter) { case 'popular': $args['orderby'] = 'meta_value'; $args['meta_key'] = 'vibe_students'; break; case 'newest': $args['orderby'] = 'date'; break; case 'rated': $args['orderby'] = 'meta_value'; $args['meta_key'] = 'average_rating'; break; case 'alphabetical': $args['orderby'] = 'title'; $args['order'] = 'ASC'; break; default: $args['orderby'] = ''; break; } } if (isset($_POST['search_terms']) && $_POST['search_terms']) { $args['search_terms'] = $_POST['search_terms']; } if (isset($_POST['page'])) { $args['paged'] = $_POST['page']; } if (isset($_POST['scope']) && $_POST['scope'] == 'personal') { $uid = get_current_user_id(); $args['meta_query'] = array(array('key' => $uid, 'compare' => 'EXISTS')); } if (isset($_POST['scope']) && $_POST['scope'] == 'instructor') { $uid = get_current_user_id(); $args['instructor'] = $uid; } if (isset($_POST['extras'])) { $extras = json_decode(stripslashes($_POST['extras'])); $course_categories = array(); $course_levels = array(); $type = array(); if (is_array($extras)) { foreach ($extras as $extra) { switch ($extra->type) { case 'course-cat': $course_categories[] = $extra->value; break; case 'free': $type = $extra->value; break; case 'level': $course_levels[] = $extra->value; break; } } } $args['tax_query'] = array(); if (count($course_categories)) { $args['tax_query']['relation'] = 'AND'; $args['tax_query'][] = array('taxonomy' => 'course-cat', 'terms' => $course_categories, 'field' => 'slug'); } if ($type) { switch ($type) { case 'free': $args['meta_query']['relation'] = 'AND'; $args['meta_query'][] = array('key' => 'vibe_course_free', 'value' => 'S', 'compare' => '='); break; case 'paid': $args['meta_query']['relation'] = 'AND'; $args['meta_query'][] = array('key' => 'vibe_course_free', 'value' => 'H', 'compare' => '='); break; } } if (count($course_levels)) { $args['tax_query']['relation'] = 'AND'; $args['tax_query'][] = array('taxonomy' => 'level', 'field' => 'slug', 'terms' => $course_levels); } } $loop_number = vibe_get_option('loop_number'); isset($loop_number) ? $loop_number : ($loop_number = 5); $args['per_page'] = $loop_number; ?> <?php do_action('bp_before_course_loop'); ?> <?php if (bp_course_has_items($args)) { ?> <div id="pag-top" class="pagination "> <div class="pag-count" id="course-dir-count-top"> <?php bp_course_pagination_count(); ?> </div> <div class="pagination-links" id="course-dir-pag-top"> <?php bp_course_item_pagination(); ?> </div> </div> <?php do_action('bp_before_directory_course_list'); $cookie = urldecode($_POST['cookie']); if (stripos($cookie, 'course_directory=grid')) { $class = 'grid'; } ?> <ul id="course-list" class="item-list <?php echo $class; ?> " role="main"> <?php while (bp_course_has_items()) { bp_course_the_item(); ?> <li> <div class="item-avatar"> <?php bp_course_avatar(); ?> </div> <div class="item"> <div class="item-title"><?php bp_course_title(); ?> </div> <div class="item-meta"><?php bp_course_meta(); ?> </div> <div class="item-desc"><?php bp_course_desc(); ?> </div> <div class="item-credits"> <?php bp_course_credits(); ?> </div> <div class="item-instructor"> <?php bp_course_instructor(); ?> </div> <div class="item-action"><?php bp_course_action(); ?> </div> <?php if ($_POST['scope'] == "personal") { ?> <div class="item_process"> <?php $course_id = get_the_ID(); $unit_id = wplms_get_course_unfinished_unit($course_id); do_action('child_wplms_course_start_after_time', $course_id, $unit_id); ?> </div> <?php } ?> <?php do_action('bp_directory_course_item'); ?> </div> <div class="clear"></div> </li> <?php } ?> </ul> <?php do_action('bp_after_directory_course_list'); ?> <div id="pag-bottom" class="pagination"> <div class="pag-count" id="course-dir-count-bottom"> <?php bp_course_pagination_count(); ?> </div> <div class="pagination-links" id="course-dir-pag-bottom"> <?php bp_course_item_pagination(); ?> </div> </div> <?php } else { ?> <div id="message" class="info"> <p><?php _e('No Courses found.', 'vibe'); ?> </p> </div> <?php } ?> <?php do_action('bp_after_course_loop'); ?> <?php die; }
function bp_course_item_view() { $filter = apply_filters('bp_course_single_item_view', 0); if ($filter) { return; } $course_classes = apply_filters('bp_course_single_item', 'course_single_item', get_the_ID()); ?> <li class="<?php echo $course_classes; ?> " itemscope itemtype="http://data-vocabulary.org/Review-aggregate"> <div class="item-avatar" itemprop="photo"> <?php bp_course_avatar(); ?> </div> <div class="item"> <div class="item-title" itemprop="itemreviewed"><?php bp_course_title(); if (get_post_status() != 'publish') { echo '<i> ( ' . get_post_status() . ' ) </i>'; } ?> </div> <div class="item-meta"><?php bp_course_meta(); ?> </div> <div class="item-desc"><?php bp_course_desc(); ?> </div> <div class="item-credits"> <?php bp_course_credits(); ?> </div> <div class="item-instructor"> <?php bp_course_instructor(); ?> </div> <div class="item-action"><?php bp_course_action(); ?> </div> <?php do_action('bp_directory_course_item'); ?> </div> <div class="clear"></div> </li> <?php }