function custom_vibe_featured_thumbnail_style($thumbnail_html, $post, $style) { if ($style == 'modern_block1') { $thumbnail_html = ''; $thumbnail_html .= '<div class="block modern_course">'; $thumbnail_html .= '<div class="block_media">'; $thumbnail_html .= '<a href="' . get_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, 'medium') . '</a>'; $thumbnail_html .= '<a href="' . bp_core_get_user_domain($post->post_author) . '" class="course_block_instructor">' . bp_course_get_instructor_avatar() . '</a>'; $thumbnail_html .= '</div>'; $thumbnail_html .= '<div class="block_content">'; $thumbnail_html .= '<h4 class="block_title"><a href="' . get_permalink($post->ID) . '" title="' . $post->post_title . '">' . $post->post_title . '</a></h4>'; $thumbnail_html .= bp_course_get_type(); $thumbnail_html .= '</div></div>'; } return $thumbnail_html; }
} foreach ($instructor as $instructor_id) { if (function_exists('vibe_get_option')) { $field = vibe_get_option('instructor_field'); } else { $field = 'Speciality'; } $displayname = bp_core_get_user_displayname($instructor_id); $special = ''; if (bp_is_active('xprofile')) { $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id); } ?> <div class="instructor_course"> <div class="item-avatar"><?php echo bp_course_get_instructor_avatar(array('item_id' => $instructor_id)); ?> </div> <h5 class="course_instructor"> <a href="<?php echo bp_core_get_user_domain($instructor_id); ?> "><?php echo $displayname; ?> <span><?php echo $special; ?> </span></a> </h5> <?php
/** * * @package BuddyPress_Skeleton_Component * @since 1.6 * * @param mixed $args Accepts WP style arguments - either a string of URL params, or an array * @return str The HTML for a user avatar */ function bp_course_get_instructor($args = NULL) { $defaults = array('instructor_id' => get_the_author_meta('ID'), 'field' => 'Expertise'); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (function_exists('vibe_get_option')) { $field = vibe_get_option('instructor_field'); } $displayname = bp_core_get_user_displayname($instructor_id); $special = ''; if (bp_is_active('xprofile')) { $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id); } $instructor = '<div class="instructor_course"> <div class="item-avatar">' . bp_course_get_instructor_avatar(array('item_id' => $instructor_id)) . '</div> <h5 class="course_instructor"><a href="' . bp_core_get_user_domain($instructor_id) . '">' . $displayname . '<span>' . $special . '</span></a> </h5>'; $instructor .= apply_filters('wplms_instructor_meta', '', $instructor_id); $instructor .= '</div>'; return apply_filters('wplms_display_course_instructor', $instructor, get_the_ID()); }
function hienthikhoahoctrangchu() { $term_id = $_POST['term_id']; $name_term = $_POST['name_term']; $language_id = $_POST['name_term_language']; $level_id = $_POST['name_term_level']; $page = $_POST['page_ajax_term']; $name_term_language_text = $_POST['name_term_language_text']; $name_term_level_text = $_POST['name_term_level_text']; if ($language_id == 0 && $level_id == 0) { $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'paged' => $page, 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => "DESC")); } else { if ($level_id != 0 && $language_id == 0) { $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'level', 'terms' => $level_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC')); } else { if ($level_id == 0 && $language_id != 0) { $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'language-category', 'terms' => $language_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC')); } else { if ($level_id != 0 && $language_id != 0) { $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'language-category', 'terms' => $language_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), array('taxonomy' => 'level', 'terms' => $level_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC')); } } } } echo '<ul class="breadcrumb-trangchu"><li><span class="breadcrumb-trangchu-dskhoahoc">Danh sách khóa học</span></li></ul>'; // echo '<ul class="breadcrumb-trangchu"><li><a href="'.get_home_url().'">Tất cả khóa học</a> > <a class="danhmuckhoahoc"><span data-id="'.$term_id.'">'.$name_term.'</span></a></li></ul>'; echo '<ul class="breadcrumb-level">'; // if($name_term_level_text=="Tất cả" && $name_term_language_text=="Tất cả"){ // echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>'; //// if($name_term == "Tất cả"){ //// echo '<li>Danh mục: <span>'.$name_term.'</span></li>'; //// }else{ // echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>'; //// } // echo '<li>Cấp độ: <span>Tất cả</span></li>'; // echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>'; // }else if($name_term_level_text!="Tất cả" && $name_term_language_text=="Tất cả"){ // echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>'; //// if($name_term == "Tất cả"){ //// echo '<li>Danh mục: <span>'.$name_term.'</span></li>'; //// }else{ // echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>'; //// } // echo '<li>Cấp độ: <span>'.$name_term_level_text.'</span><i class="icon-x"></i></li>'; // echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>'; // }else if($name_term_level_text=="Tất cả" && $name_term_language_text!="Tất cả"){ // echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>'; //// if($name_term == "Tất cả"){ //// echo '<li>Danh mục: <span>'.$name_term.'</span></li>'; //// }else{ // echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>'; //// } // echo '<li>Cấp độ: <span>Tất cả</span></li>'; // echo '<li>Ngôn ngữ lập trình: <span>'.$name_term_language_text.'</span><i class="icon-x"></i></li>'; // }else{ // echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>'; //// if($name_term == "Tất cả"){ //// echo '<li>Danh mục: <span>'.$name_term.'</span></li>'; //// }else{ // echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>'; //// } // echo '<li>Cấp độ: <span>'.$name_term_level_text.'</span><i class="icon-x"></i></li>'; // echo '<li>Ngôn ngữ lập trình: <span>'.$name_term_language_text.'</span><i class="icon-x"></i></li>'; // } echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>'; echo '<li>Danh mục: <span>' . $name_term . '</span><i class="icon-x" data-id="1"></i></li>'; if ($level_id == 0) { echo '<li>Cấp độ: <span>Tất cả</span></li>'; } else { echo '<li>Cấp độ: <span>' . $name_term_level_text . '</span><i class="icon-x" data-id="2"></i></li>'; } if ($language_id == 0) { echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>'; } else { echo '<li>Ngôn ngữ lập trình: <span>' . $name_term_language_text . '</span><i class="icon-x" data-id="3"></i></li>'; } echo '</ul>'; $wp_query = new WP_Query($arg); $countcourse = count($wp_query); if ($countcourse == 0) { echo "Không tìm thấy khóa học"; } else { echo '<ul class="grid">'; while ($wp_query->have_posts()) { $wp_query->the_post(); $course_id = get_the_ID(); $course_curriculum = vibe_sanitize(get_post_meta($course_id, 'vibe_course_curriculum', false)); $dem = 0; if (isset($course_curriculum)) { foreach ($course_curriculum as $item) { if (isset($item)) { $dem++; } } } echo '<li class="clear3 col-md-4">'; echo '<div class="block courseitem">'; echo '<div class="block_media">'; echo bp_course_avatar(); echo '<div class="avatar-list"><div class="hinhgiangvien">' . bp_course_get_instructor_avatar() . '</div><div class="tongbaihoc">' . $dem . ' bài học</div>' . '<div class="thoiluongvideo">Video ' . tongthoigianvideokhoahoc($course_id) . '</div>' . '</div>'; echo nuthanhtoan(); echo '</div>'; echo '<div class="block_content">'; echo '<h4 class="block_title">'; echo bp_course_title(); echo '</h4>'; echo '<div class="item-meta">'; echo bp_course_meta(); echo '</div>'; // echo '<div class="item-credits">'; // echo bp_course_credits(); // echo '</div>'; echo '<div class="item-instructor">'; echo bp_course_instructor(); echo '</div>'; echo '<div class="item-action">'; echo bp_course_action(); echo '</div>'; echo '<div class="item_process">'; echo '</div>'; echo do_action('bp_directory_course_item'); echo '<div class="clear"></div>'; echo '<div class="item-credits" style="width:100%; padding-top:12px; border-top:1px solid #EEE">'; echo bp_course_credits(); echo '</div>'; echo '</div>'; echo '<div class="clear"></div>'; echo '</div>'; echo '</li>'; } echo '</ul><p></p>'; wp_reset_postdata(); echo '<div class="clear"></div>'; // phân trang trang chủ $num_page = $wp_query->max_num_pages; // echo '<div><ul class="sophantrang">'; // if(empty($page)){ // for($i=1; $i<6; $i++){ // if($i <= $num_page){ // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$i.'"><span>'.$i.'</span></a></li>'; // }else{ // return die(); // } // } // echo '<li><span>...</span></li>'; // }else{ // if($page !=1){ // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="1"><span> << Trang đầu</span></a></li>'; // echo '<li><span>...</span></li>'; // } // for($i=$page; $i<$page+5; $i++){ // if($i <= $num_page){ // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$i.'"><span>'.$i.'</span></a></li>'; // }else{ // return die(); // } // } // if($page+5 <= $num_page){ // echo '<li><span>...</span></li>'; // } // } // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$num_page.'"><span>Trang cuối >></span></a></li>'; // echo '</ul></div>'; echo '<div><ul class="sophantrang">'; if (empty($page)) { for ($i = 1; $i < 6; $i++) { if ($i <= $num_page) { if ($i == 1) { echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange"><span>' . $i . '</span></li></a>'; } else { echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>'; } } else { return die; } } echo '<li><span>...</span></li>'; } else { if ($page % 6 == 0) { echo '<a class="sotrang" data-id="1"><li><span> << Trang đầu</span></li></a>'; echo '<li><span>...</span></li>'; for ($i = $page; $i < $page + 5; $i++) { if ($i <= $num_page) { if ($i == $page) { echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange" ><span>' . $i . '</span></li></a>'; } else { echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>'; } } else { return die; } } } else { for ($i = 1; $i < $page + 5; $i++) { if ($i <= $num_page) { if ($i == $page) { echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange" ><span>' . $i . '</span></li></a>'; } else { echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>'; } } else { return die; } } } if ($page + 5 <= $num_page) { echo '<li><span>...</span></li>'; } } echo '<a class="sotrang" data-id="' . $num_page . '"><li><span>Trang cuối >></span></li></a>'; echo '</ul></div>'; } die; }