} else {
                vibe_breadcrumbs();
            }
        }
        ?>
            </div>
        </div>
    </div>
</section>
<section id="content">
    <div class="container">
        
        <div class="row">
            <div class="col-md-9 col-sm-8">
                    <?php 
        echo apply_filters('wplms_event_access_thumbnail', thumbnail_generator($post, 'event_card'));
        ?>
                    <div class="content">
                        <?php 
        do_action('wplms_event_before_content');
        ?>
                        <div class="extra_buttons">
                            <?php 
        do_action('wplms_event_extra_buttons');
        if (vibe_validate($print)) {
            echo '<a href="#" class="certificate_print"><i class="icon-printer-1"></i></a>';
        }
        ?>
                        </div>
                        
                        <?php 
function vibe_post_grid($atts, $content = null)
{
    global $vibe_options;
    $error = new VibeErrors();
    if (!isset($atts) || !isset($atts['post_type'])) {
        return $error->get_error('unsaved_editor');
    }
    $attributes = v_get_attributes($atts, "vibe_post_grid");
    if (isset($atts['masonry']) && $atts['masonry']) {
        wp_enqueue_script('masonry-js', VIBE_PLUGIN_URL . '/vibe-shortcodes/js/masonry.min.js', array('jquery'), '1.0', true);
        $atts['custom_css'] .= '.grid.masonry li .block { margin-bottom:' . (isset($atts['gutter']) ? $atts['gutter'] : '30') . 'px;}';
    }
    if ($atts['custom_css'] && strlen($atts['custom_css']) > 5) {
        $output = '<style>' . $atts['custom_css'] . '</style>';
    } else {
        $output = '';
    }
    $output .= "<div {$attributes['class']}{$attributes['inline_styles']}>";
    if (!isset($atts['post_ids']) || strlen($atts['post_ids']) < 2) {
        if (isset($atts['term']) && isset($atts['taxonomy']) && $atts['term'] != 'nothing_selected') {
            if (isset($atts['taxonomy']) && $atts['taxonomy'] != '') {
                $check = term_exists($atts['term'], $atts['taxonomy']);
                if ($atts['term'] != 'nothing_selected') {
                    if ($check == 0 || $check == null || !$check) {
                        $error = new VibeErrors();
                        $output .= $error->get_error('term_taxonomy_mismatch');
                        $output .= '</div>';
                        return $output;
                    }
                }
                $check = is_object_in_taxonomy($atts['post_type'], $atts['taxonomy']);
                if ($check == 0 || $check == null || !$check) {
                    $error = new VibeErrors();
                    $output .= $error->get_error('term_postype_mismatch');
                    $output .= '</div>';
                    return $output;
                }
            }
            if ($atts['column_width'] < 311) {
                $cols = 'small';
            }
            if ($atts['column_width'] >= 311 && $atts['column_width'] < 460) {
                $cols = 'medium';
            }
            if ($atts['column_width'] >= 460 && $atts['column_width'] < 769) {
                $cols = 'big';
            }
            if ($atts['column_width'] >= 769) {
                $cols = 'full';
            }
            if (isset($atts['taxonomy']) && $atts['taxonomy'] != '') {
                if ($atts['taxonomy'] == 'category') {
                    $atts['taxonomy'] = 'category_name';
                }
                if ($atts['taxonomy'] == 'tag') {
                    $atts['taxonomy'] = 'tag_name';
                }
            }
            $query_args = array('post_type' => $atts['post_type'], $atts['taxonomy'] => $atts['term'], 'posts_per_page' => $atts['grid_number']);
        } else {
            $query_args = array('post_type' => $atts['post_type'], 'posts_per_page' => $atts['grid_number']);
        }
        if ($atts['post_type'] == 'course') {
            switch ($atts['course_style']) {
                case 'popular':
                    $query_args['orderby'] = 'meta_value_num';
                    $query_args['meta_key'] = 'vibe_students';
                    break;
                case 'rated':
                    $query_args['orderby'] = 'meta_value_num';
                    $query_args['meta_key'] = 'average_rating';
                    break;
                case 'reviews':
                    $query_args['orderby'] = 'comment_count';
                    break;
                case 'start_date':
                    $args['orderby'] = 'meta_value';
                    $args['meta_key'] = 'vibe_start_date';
                    $args['meta_type'] = 'DATE';
                    $args['order'] = 'ASC';
                    break;
                case 'random':
                    $query_args['orderby'] = 'rand';
                    break;
            }
            $query_args = apply_filters('wplms_grid_course_filters', $query_args);
        }
    } else {
        $cus_posts_ids = explode(",", $atts['post_ids']);
        $query_args = array('post_type' => $atts['post_type'], 'post__in' => $cus_posts_ids);
    }
    global $paged;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif (get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    if (isset($atts['pagination']) && $atts['pagination']) {
        $query_args['paged'] = $paged;
    }
    $istyle = '';
    query_posts($query_args);
    $masonry = $style = $rel = '';
    if (isset($atts['masonry']) && $atts['masonry']) {
        $atts['grid_columns'] = ' grid-item';
        $style = 'style="width:' . $atts['column_width'] . 'px;"';
        $masonry = 'masonry';
        $istyle .= ' data-width="' . $atts['column_width'] . '" data-gutter="' . (isset($atts['gutter']) ? $atts['gutter'] : '30') . '"';
        // Rel-width used in Masonry+infinite scroll
    } else {
        $cols = $atts['grid_columns'];
    }
    $infinite = '';
    if (isset($atts['infinite']) && $atts['infinite']) {
        $infinite = ' inifnite_scroll';
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $rel = 'data-page=' . $paged;
    }
    if (isset($atts['title']) && $atts['title'] && $atts['title'] != 'Content') {
        $ntitle = $atts['title'];
        $ntitle = preg_replace('/[^a-zA-Z0-9\']/', '_', $ntitle);
        $ntitle = str_replace("'", '', $ntitle);
        $output .= '<div id="' . $ntitle . '"></div>';
    }
    global $wp_query;
    if ($atts['show_title']) {
        $output .= '<h3 class="heading"><span>' . $atts['title'] . '</span></h3>';
    }
    $output .= '<div class="vibe_grid ' . $infinite . ' ' . $masonry . '" ' . $rel . '><div class="wp_query_args" data-max-pages="' . $wp_query->max_num_pages . '">' . json_encode($atts) . '</div>';
    if (have_posts()) {
        $output .= '<ul class="grid ' . $masonry . '" ' . $istyle . '>';
        while (have_posts()) {
            the_post();
            global $post;
            $output .= '<li class="' . $atts['grid_columns'] . '" ' . $style . '>';
            $output .= thumbnail_generator($post, $atts['featured_style'], $cols, $atts['grid_excerpt_length'], $atts['grid_link'], $atts['grid_lightbox']);
            $output .= '</li>';
        }
        $output .= '</ul>';
    } else {
        $error = new VibeErrors();
        $output .= $error->get_error('no_posts');
    }
    wp_reset_postdata();
    $output .= '</div>';
    if (isset($atts['infinite']) && $atts['infinite']) {
        $output .= '<div class="load_grid"><span>' . __('Loading..', 'vibe-customtypes') . '</i></span></div>
                        <div class="end_grid"><span>' . __('No more to load', 'vibe-customtypes') . '</i></span></div>';
    }
    $output .= "</div>";
    if (isset($atts['pagination']) && $atts['pagination']) {
        ob_start();
        pagination();
        $output .= ob_get_contents();
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    return $output;
}
 function testimonial($atts, $content = null)
 {
     global $vibe_options;
     extract(shortcode_atts(array('id' => '', 'length' => 100), $atts));
     if ($id == 'random') {
         $args = array('post_type' => 'testimonials', 'orderby' => 'rand', 'posts_per_page' => '1', 'fields=ids');
         $testimonials = new WP_Query($args);
         while ($testimonials->have_posts()) {
             $testimonials->the_post();
             $postdata = get_post(get_the_ID());
         }
         wp_reset_postdata();
     } else {
         $postdata = get_post($id);
     }
     if (function_Exists('thumbnail_generator')) {
         $return = thumbnail_generator($postdata, 'testimonial', 3, $length, 0, 0);
     }
     return $return;
 }
            <?php 
$select_boxes = apply_filters('wplms_course_search_selects', 'instructors=1&cats=1&location=1&level=1');
echo the_widget('BP_Course_Search_Widget', $select_boxes, array());
?>
        </div>
        <?php 
do_action('wplms_course_sidebar_hook');
?>
        <div class="search_results">
            <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        //if($post->post_type == 'course'){
        if (function_exists('thumbnail_generator')) {
            echo '<div class="col-md-3 clear4">' . thumbnail_generator($post, 'course', 'medium', 0, 0, 0) . '</div>';
        } else {
            echo ' <div class="blogpost">
                            <div class="meta">
                               <div class="date">
                                <p class="day"><span>' . get_the_time('j') . '</span></p>
                                <p class="month">' . get_the_time('M') . '</p>
                               </div>
                            </div>
                            ' . (has_post_thumbnail(get_the_ID()) ? '
                            <div class="featured">
                                <a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), 'full') . '</a>
                            </div>' : '') . '
                            <div class="excerpt ' . (has_post_thumbnail(get_the_ID()) ? 'thumb' : '') . '">
                                <h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>
                                <div class="cats">
<section id="content">
	<div id="buddypress">
    <div class="container">
		<div class="padder">
		<?php 
do_action('bp_before_directory_course');
?>
	
		<div class="row">
			<div class="col-md-12 col-sm-8">
				<div class="content padding_adjusted">
				<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo '<div class="col-md-4 col-sm-6 clear3">' . thumbnail_generator($post, 'course', '3', '0', true, true) . '</div>';
    }
    pagination();
}
?>
				</div>
			</div>	
			<!--<div class="col-md-3 col-sm-3">
				<?php 
$sidebar = apply_filters('wplms_sidebar', 'coursesidebar');
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($sidebar)) {
    ?>
                <?php 
}
?>
			</div>-->
Beispiel #6
0
</section>
<section id="content">
	<div id="buddypress">
    <div class="container">

		<div class="padder">

		<div class="row">
			<div class="col-md-12">
			<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        global $post;
        $style = apply_filters('wplms_instructor_courses_style', 'modern1');
        echo '<div class="col-md-3 col-sm-6">' . thumbnail_generator($post, $style, '3', '0', true, true) . '</div>';
    }
    pagination();
}
?>
			</div>	
		</div>	
		<?php 
do_action('bp_after_directory_course');
?>

		</div><!-- .padder -->
	
	<?php 
do_action('bp_after_directory_course_page');
?>
Beispiel #7
0
    function widget($args, $instance)
    {
        extract($args);
        extract($instance);
        //Our variables from the widget settings.
        $title = apply_filters('widget_title', $instance['title']);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        if (isset($ids) && strlen($ids) > 1) {
            $ids = explode($ids);
            $qargs = array('post_type' => $type, 'orderby' => $order, 'order' => $sort, 'post__in' => $ids);
        } else {
            $qargs = array('post_type' => $type, 'orderby' => $order, 'order' => $sort, 'posts_per_page' => $num);
        }
        ?>
              <div class="widget_carousel flexslider <?php 
        echo $instance['theme'] . ' ' . (isset($instance['auto']) ? 'auto' : '') . ' ' . (isset($instance['loop']) ? 'loop' : '');
        ?>
 loading">
              <ul class="slides">
                  <?php 
        $the_query = new WP_Query($qargs);
        while ($the_query->have_posts()) {
            $the_query->the_post();
            global $post;
            echo '<li>' . thumbnail_generator($post, $style, '3', $excerpt_length, false, false) . '</li>';
        }
        wp_reset_postdata();
        ?>
              </ul> 
          </div>  
    <?php 
        echo $after_widget;
    }
Beispiel #8
0
            foreach ($terms as $term) {
                $categories[] = $term->term_id;
            }
        }
        $args = apply_filters('wplms_moern_related_courses', array('post_type' => 'course', 'posts_per_page' => 3, 'tax_query' => array('relation' => 'OR', array('taxonomy' => 'course-cat', 'field' => 'id', 'terms' => $categories))));
        $args = apply_filters('wplms_carousel_course_filters', $args);
        $courses = new WP_Query($args);
        if ($courses->have_posts()) {
            ?>
	<ul class="row">
	<?php 
            while ($courses->have_posts()) {
                $courses->the_post();
                echo '<li class="col-md-4">';
                $style = vibe_get_option('related_course_style');
                if (empty($style)) {
                    $style = 'modern1';
                }
                echo thumbnail_generator($post, $style, 'medium');
                echo '</li>';
            }
            ?>
	</ul>
	<?php 
        }
        wp_reset_postdata();
        ?>
</div>
<?php 
    }
}
    function widget($args, $instance)
    {
        global $bp, $wpdb;
        extract($args);
        extract($instance, EXTR_SKIP);
        echo $before_widget;
        if (isset($title) && $title != '') {
            echo $before_title . $title . $after_title;
        }
        global $post;
        if ($post->post_type == 'course') {
            $post_not_in = $post->ID;
        }
        echo '<div class="widget_carousel flexslider  no-ajax"><ul class="slides">';
        if (isset($course) && $course != '' && strlen($course) > 1) {
            $course_ids = explode(',', $course);
            $the_query = new WP_Query(array('ID' => $course_ids));
        } else {
            global $post;
            $args = array('post_type' => 'course', 'post__not_in' => array($post->ID), 'posts_per_page' => $number);
            if ($category) {
                if (is_singular('course')) {
                    global $post;
                    $terms_list = wp_get_post_terms($post->ID, 'course-cat', array("fields" => "all"));
                    if (isset($terms_list) && is_array($terms_list)) {
                        $args['tax_query'] = array('relation' => 'AND');
                        $terms_slug_array = array();
                        foreach ($terms_list as $term) {
                            $terms_slug_array[] = $term->slug;
                        }
                        $args['tax_query'][] = array('taxonomy' => 'course-cat', 'field' => 'slug', 'terms' => $terms_slug_array);
                    }
                }
            }
            if ($instructor) {
                global $post;
                if (is_singular('course')) {
                    $instructor_ids = apply_filters('wplms_course_instructor', get_post_field('post_author', $post->ID), $post->ID);
                    if (is_numeric($instructor_ids)) {
                        $instructor_ids = array($instructor_ids);
                    }
                    $args['author__in'] = $instructor_ids;
                }
            }
            if ($location) {
                if (is_singular('course')) {
                    $terms_list = wp_get_post_terms(get_the_ID(), 'location', array("fields" => "all"));
                    if (isset($terms_list) && is_array($terms_list)) {
                        if (!isset($args['tax_query']['relation'])) {
                            $args['tax_query'] = array('relation' => 'AND');
                        }
                        $terms_slug_array = array();
                        foreach ($terms_list as $term) {
                            $terms_slug_array[] = $term->slug;
                        }
                        $args['tax_query'][] = array('taxonomy' => 'location', 'field' => 'slug', 'terms' => $terms_slug_array);
                    }
                }
            }
            if ($level) {
                if (is_singular('course')) {
                    $terms_list = wp_get_post_terms(get_the_ID(), 'level', array("fields" => "all"));
                    if (isset($terms_list) && is_array($terms_list)) {
                        if (!isset($args['tax_query']['relation'])) {
                            $args['tax_query'] = array('relation' => 'AND');
                        }
                        $terms_slug_array = array();
                        foreach ($terms_list as $term) {
                            $terms_slug_array[] = $term->slug;
                        }
                        $args['tax_query'][] = array('taxonomy' => 'level', 'field' => 'slug', 'terms' => $terms_slug_array);
                    }
                }
            }
            if ($linkage) {
                if (is_singular('course')) {
                    $terms_list = wp_get_post_terms(get_the_ID(), 'linkage', array("fields" => "all"));
                    if (isset($terms_list) && is_array($terms_list)) {
                        if (!isset($args['tax_query']['relation'])) {
                            $args['tax_query'] = array('relation' => 'AND');
                        }
                        $terms_slug_array = array();
                        foreach ($terms_list as $term) {
                            $terms_slug_array[] = $term->slug;
                        }
                        $args['tax_query'][] = array('taxonomy' => 'linkage', 'field' => 'slug', 'terms' => $terms_slug_array);
                    }
                }
            }
            if (!empty($post_not_in)) {
                $args['post__not_in'] = array($post_not_in);
            }
            $the_query = new WP_Query($args);
        }
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                echo '<li>';
                if (empty($style)) {
                    $style = 'course2';
                }
                echo thumbnail_generator($the_query->post, $style, 3, 0, 0, 0);
                echo '</li>';
            }
        } else {
            echo '<div class="message">' . __('No related courses found !', 'vibe') . '</div>';
        }
        wp_reset_postdata();
        echo '</ul></div>';
        echo $after_widget;
        ?>
	<?php 
    }
Beispiel #10
0
    function wplms_modern_course_front()
    {
        $style = vibe_get_option('related_course_style');
        if (isset($style) && empty($style)) {
            return;
        }
        ?>
		<div class="related_courses">
		<h2><?php 
        _e('Related Courses', 'wplms_modern');
        ?>
</h2>
		<?php 
        $terms = wp_get_post_terms(get_the_ID(), 'course-cat');
        $categories = array();
        if (!empty($terms)) {
            foreach ($terms as $term) {
                $categories[] = $term->term_id;
            }
        }
        $args = apply_filters('wplms_moern_related_courses', array('post_type' => 'course', 'posts_per_page' => 3, 'post__not_in' => array(get_the_ID()), 'tax_query' => array('relation' => 'OR', array('taxonomy' => 'course-cat', 'field' => 'id', 'terms' => $categories))));
        $courses = new WP_Query($args);
        if ($courses->have_posts()) {
            ?>
			<ul class="row">
			<?php 
            while ($courses->have_posts()) {
                $courses->the_post();
                global $post;
                echo '<li class="col-md-4">';
                if (empty($style)) {
                    $style = 'modern1';
                }
                echo thumbnail_generator($post, $style, 'medium');
                echo '</li>';
            }
            ?>
			</ul>
			<?php 
        } else {
            ?>
			<div class="message">
			<p><?php 
            _e('No related courses found', 'wplms_modern');
            ?>
</p>
			</div>
			<?php 
        }
        wp_reset_postdata();
        ?>
		</div>
		<?php 
    }
function vibe_grid_scroll()
{
    $atts = json_decode(stripslashes($_POST['args']), true);
    $output = '';
    $paged = stripslashes($_POST['page']);
    $paged++;
    if (!isset($atts['post_ids']) || count($atts['post_ids']) > 0) {
        if (isset($atts['term']) && isset($atts['taxonomy']) && $atts['term'] != 'nothing_selected') {
            if (isset($atts['taxonomy']) && $atts['taxonomy'] != '') {
                if ($atts['taxonomy'] == 'category') {
                    $atts['taxonomy'] = 'category_name';
                }
                if ($atts['taxonomy'] == 'tag') {
                    $atts['taxonomy'] = 'tag_name';
                }
            }
            $query_args = array('post_type' => $atts['post_type'], $atts['taxonomy'] => $atts['term'], 'posts_per_page' => $atts['grid_number'], 'paged' => $paged);
        } else {
            $query_args = array('post_type' => $atts['post_type'], 'posts_per_page' => $atts['grid_number'], 'paged' => $paged);
        }
        $style = '';
        if (isset($atts['masonry']) && $atts['masonry']) {
            $style = 'style="width:' . $atts['column_width'] . 'px;"';
        }
        $query_args = apply_filters('wplms_grid_course_filters', $query_args);
        query_posts($query_args);
        while (have_posts()) {
            the_post();
            global $post;
            $output .= '<li ' . (isset($atts['grid_columns']) ? 'class="' . $atts['grid_columns'] . '"' : '') . ' ' . $style . '>';
            $output .= thumbnail_generator($post, $atts['featured_style'], $atts['grid_columns'], $atts['grid_excerpt_length'], $atts['grid_link'], $atts['grid_lightbox']);
            $output .= '</li>';
        }
        wp_reset_query();
        wp_reset_postdata();
        echo $output;
    } else {
        echo '0';
    }
    die;
}
<section id="content">
	<div id="buddypress">
    <div class="container">
		<div class="padder">
		<?php 
do_action('bp_before_directory_course');
?>
	
		<div class="row">
			<div class="col-md-12">
				<div class="content padding_adjusted">
				<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo '<div class="col-md-4 col-sm-6 clear3">' . thumbnail_generator($post, 'modern1', 'medium', '0', true, true) . '</div>';
    }
    pagination();
}
?>
				</div>
			</div>	
		</div>	
		<?php 
do_action('bp_after_directory_course');
?>

		</div><!-- .padder -->
	
	<?php 
do_action('bp_after_directory_course_page');
    function widget($args, $instance)
    {
        global $wpdb, $bp;
        extract($args);
        extract($instance, EXTR_SKIP);
        echo $before_widget;
        if (isset($title) && $title != '') {
            echo $before_title . $title . $after_title;
        }
        //Preparing Query
        if (isset($ids) && $ids != '' && strlen($ids) > 3) {
            $course_ids = explode(',', $ids);
            $the_query = new WP_QUERY(array('post_type' => WPLMS_EVENTS_CPT, 'post__in' => $course_ids));
        } else {
            $current_date = date('Y-m-d');
            if (!isset($date_range) || !is_numeric($date_range)) {
                $date_range = 1;
            }
            $range_date = date('Y-m-d', time() + 86400 * $date_range);
            $qargs = array('post_type' => WPLMS_EVENTS_CPT, 'post_status' => 'publish');
            if (isset($event_type) && $event_type != '' && $event_type != 'none') {
                $qargs['event_type'] = $event_type;
            }
            if (isset($date_range) && $date_range != '') {
                $qargs['meta_query'] = array('relation' => '"AND"');
                if (isset($show_start_events) && $show_start_events) {
                    $qargs['meta_query'][] = array('key' => 'vibe_start_date', 'compare' => 'BETWEEN', 'value' => array($current_date, $range_date), 'type' => 'DATE');
                }
                if (isset($show_end_events) && $show_end_events) {
                    $qargs['meta_query'][] = array('key' => 'vibe_end_date', 'compare' => 'BETWEEN', 'value' => array($current_date, $range_date), 'type' => 'DATE');
                }
            }
            if (isset($show_course_events) && $show_course_events) {
                if (is_single() && get_post_type() == 'course') {
                    $qargs['meta_query'][] = array('key' => 'vibe_event_course', 'compare' => '=', 'value' => get_the_ID(), 'type' => 'DECIMAL');
                }
            }
            if ($orderby == 'name' || $orderby == 'comment_count' || $orderby == 'date' || $orderby == 'title' || $orderby == 'rand') {
                $qargs['orderby'] = $orderby;
            } else {
                if ($orderby != 'default') {
                    $qargs['orderby'] = 'meta_value';
                    $qargs['meta_key'] = $orderby;
                }
            }
            $qargs['posts_per_page'] = $max_items;
            $qargs['order'] = $order;
            $the_query = new WP_Query($qargs);
        }
        ?>
     
	<?php 
        if ($the_query->have_posts()) {
            switch ($style) {
                case 'list':
                    echo '<ul class="widget_event_list no-ajax">';
                case 'carousel':
                    echo '<div class="widget_carousel flexslider  no-ajax"><ul class="slides">';
                    break;
            }
            while ($the_query->have_posts()) {
                $the_query->the_post();
                global $post;
                $icon = get_post_meta($post->ID, 'vibe_icon', true);
                $color = get_post_meta($post->ID, 'vibe_color', true);
                $start_date = get_post_meta($post->ID, 'vibe_start_date', true);
                $end_date = get_post_meta($post->ID, 'vibe_end_date', true);
                switch ($style) {
                    case 'list':
                        echo '<li><a href="' . get_permalink($post->ID) . '">
     	<i class="' . $icon . '" style="color:' . $color . '"></i>
     	<strong>' . get_the_title($post->ID) . '<span>
     	<i class="icon-calendar"></i> ' . date('dS, M', strtotime($start_date)) . ' ' . __('To', 'wplms-events') . ' ' . date('dS, M', strtotime($end_date)) . '
     	</span>
     	</strong>
     	</a></li>';
                        break;
                    case 'carousel':
                        echo '<li>';
                        echo thumbnail_generator($post, 'event_card', '3', '0', true, true);
                        echo '</li>';
                        break;
                    default:
                        echo '<div class="single_event">';
                        echo thumbnail_generator($post, 'event_card', '3', '0', true, true);
                        echo '</div>';
                        break;
                }
            }
            switch ($style) {
                case 'list':
                    echo '</ul>';
                    break;
                case 'carousel':
                    echo '</ul></div>';
                    break;
            }
        } else {
            echo '<div class="error">' . __('No Events in next ', 'wplms-events') . $date_range . __(' days', 'wplms-events') . '</div>';
        }
        wp_reset_postdata();
        echo $after_widget;
        ?>
	<?php 
    }
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        extract($instance, EXTR_SKIP);
        echo $before_widget;
        if (isset($title) && $title != '') {
            echo $before_title . $title . $after_title;
        }
        //Preparing Query
        if (isset($ids) && $ids != '' && strlen($ids) > 5) {
            $course_ids = explode(',', $ids);
            $the_query = new WP_QUERY(array('post_type' => 'course', 'post__in' => $course_ids));
        } else {
            $qargs = array('post_type' => 'course');
            if (isset($category) && $category != '' && $category != 'none') {
                $qargs['course-cat'] = $category;
            }
            if ($orderby == 'name' || $orderby == 'comment_count' || $orderby == 'date' || $orderby == 'title' || $orderby == 'rand') {
                $qargs['orderby'] = $orderby;
            } else {
                $qargs['orderby'] = 'meta_value';
                $qargs['meta_key'] = $orderby;
            }
            $qargs['posts_per_page'] = $max_items;
            $qargs['order'] = $order;
            $the_query = new WP_Query($qargs);
        }
        switch ($style) {
            case 'list':
            case 'list1':
                echo '<ul class="widget_course_list no-ajax">';
                break;
            case 'carousel':
                echo '<div class="widget_carousel flexslider  no-ajax"><ul class="slides">';
                break;
        }
        ?>
     
	<?php 
        while ($the_query->have_posts()) {
            $the_query->the_post();
            global $post;
            switch ($style) {
                case 'list':
                    echo '<li><a href="' . get_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, 'thumbnail') . '<h6>' . get_the_title($post->ID) . '<span>' . __('by', 'vibe') . ' ' . bp_core_get_user_displayname($post->post_author) . '</span></h6></a></li>';
                    break;
                case 'list1':
                    echo '<li itemscope itemtype="http://schema.org/Product"><a href="' . get_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, 'thumbnail') . '<h6><em itemprop="name">' . get_the_title($post->ID) . '</em><span>' . bp_course_get_course_meta() . '</span></h6></a></li>';
                    break;
                case 'carousel':
                    echo '<li>';
                    echo thumbnail_generator($post, 'course', '3', '0', true, true);
                    echo '</li>';
                    break;
                default:
                    echo '<div class="single_course">';
                    echo thumbnail_generator($post, 'course', '3', '0', true, true);
                    echo '</div>';
                    break;
            }
        }
        wp_reset_postdata();
        ?>
	<?php 
        switch ($style) {
            case 'list1':
            case 'list':
                echo '</ul>';
                break;
            case 'carousel':
                echo '</ul></div>';
                break;
        }
        ?>
	<?php 
        echo $after_widget;
        ?>
	<?php 
    }