本文整理汇总了PHP中bp_course_has_items函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_course_has_items函数的具体用法?PHP bp_course_has_items怎么用?PHP bp_course_has_items使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_course_has_items函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_header
<?php
get_header('buddypress');
$vibe = Wplms_Modern_Init::init();
$bg = get_post_meta(get_the_ID(), 'vibe_course_bg', true);
if (empty($bg)) {
$url = $vibe->option('hero_img');
} else {
$url = wp_get_attachment_image_src($bg, 'full');
}
if (bp_course_has_items()) {
while (bp_course_has_items()) {
bp_course_the_item();
?>
<section id="content">
<div id="buddypress">
<div class="course_header">
<?php
do_action('bp_before_course_home_content');
?>
<div id="item-header" role="complementary" <?php
echo empty($url) ? '' : 'style="background:url(' . (is_array($url) ? $url[0] : $url) . ') 50% 50% no-repeat;"';
?>
>
<?php
locate_template(array('course/single/course-header.php'), true);
?>
示例2: bp_group_id
?>
<option value="<?php
bp_group_id();
?>
" data-object="groups"><?php
echo sprintf(__('Group : %s ', 'vibe'), bp_get_group_name());
?>
</option>
<?php
}
}
$user_id = get_current_user_id();
if (bp_course_has_items(array('user_id' => $user_id, 'per_page' => 999))) {
while (bp_course_has_items(array('user_id' => $user_id, 'per_page' => 999))) {
bp_course_the_item();
?>
<option value="<?php
echo bp_course_get_ID();
?>
" data-object="course"><?php
echo sprintf(__('Course : %s', 'vibe'), bp_course_get_name());
?>
</option>
<?php
}
}
wp_reset_postdata();
?>
</select>
示例3: child_course_filter
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">
//.........这里部分代码省略.........
示例4: course_filter
//.........这里部分代码省略.........
case 'paid':
$args['meta_query']['relation'] = 'AND';
$args['meta_query'][] = array('key' => 'vibe_course_free', 'value' => 'H', 'compare' => '=');
break;
}
}
if (!empty($start_date)) {
$args['meta_query']['relation'] = 'AND';
$args['meta_query'][] = array('key' => 'vibe_start_date', 'value' => $start_date, 'compare' => '>=');
}
if (!empty($end_date)) {
$args['meta_query']['relation'] = 'AND';
$args['meta_query'][] = array('key' => 'vibe_start_date', 'value' => $end_date, 'compare' => '<=');
}
if (count($course_levels)) {
$args['tax_query']['relation'] = 'AND';
$args['tax_query'][] = array('taxonomy' => 'level', 'field' => 'slug', 'terms' => $course_levels);
}
if (count($course_location)) {
$args['tax_query']['relation'] = 'AND';
$args['tax_query'][] = array('taxonomy' => 'location', 'field' => 'slug', 'terms' => $course_location);
}
}
$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, 'bp-course-list=grid')) {
$class = 'grid';
}
?>
<ul id="course-list" class="item-list <?php
echo apply_filters('wplms_course_directory_list', $class);
?>