本文整理汇总了PHP中gdlr_get_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP gdlr_get_pagination函数的具体用法?PHP gdlr_get_pagination怎么用?PHP gdlr_get_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gdlr_get_pagination函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gdlr_get_blog_full
$gdlr_post_settings['blog-style'] = $theme_option['archive-blog-style'];
echo '<div class="blog-item-holder">';
if ($theme_option['archive-blog-style'] == 'blog-full') {
echo gdlr_get_blog_full($wp_query);
} else {
if ($theme_option['archive-blog-style'] == 'blog-medium') {
echo gdlr_get_blog_medium($wp_query);
} else {
$blog_size = str_replace('blog-1-', '', $theme_option['archive-blog-style']);
echo gdlr_get_blog_grid($wp_query, $blog_size, 'fitRows');
}
}
echo '</div>';
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
echo gdlr_get_pagination($wp_query->max_num_pages, $paged);
} else {
?>
<div class="gdlr-item page-not-found-item">
<div class="page-not-found-block" >
<div class="page-not-found-icon">
<?php
if (!empty($theme_option['new-fontawesome']) && $theme_option['new-fontawesome'] == 'enable') {
?>
<i class="fa fa-frown-o"></i>
<?php
} else {
?>
<i class="icon-frown"></i>
<?php
}
示例2: gdlr_print_portfolio_item
function gdlr_print_portfolio_item($settings = array())
{
gdlr_include_portfolio_scirpt();
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$settings['title-type'] = empty($settings['title-type']) ? 'none' : $settings['title-type'];
$settings['title'] = empty($settings['title']) ? '' : $settings['title'];
$settings['caption'] = empty($settings['caption']) ? '' : $settings['caption'];
$settings['icon'] = empty($settings['icon']) ? '' : $settings['icon'];
$right_text = '';
$right_text_class = '';
$carousel = false;
$settings['right-text'] = empty($settings['right-text']) ? '' : $settings['right-text'];
$settings['right-text-link'] = empty($settings['right-text-link']) ? '' : $settings['right-text-link'];
if (!empty($settings['right-text-link']) && !empty($settings['right-text'])) {
$right_text_class = 'gdlr-right-text ';
$right_text .= '<a class="gdlr-right-text-link" href="' . $settings['right-text-link'] . '" >' . $settings['right-text'] . '</a>';
}
if ($settings['portfolio-layout'] == 'carousel') {
$carousel = true;
$right_text_class .= 'gdlr-nav-container ';
}
$ret = gdlr_get_item_title(array('title' => $settings['title'], 'caption' => $settings['caption'], 'icon' => $settings['icon'], 'type' => $settings['title-type'], 'carousel' => $carousel, 'additional_class' => $right_text_class, 'additional_html' => $right_text));
$ret .= '<div class="portfolio-item-wrapper type-' . $settings['portfolio-style'] . '" ';
$ret .= $item_id . $margin_style . ' data-ajax="' . AJAX_URL . '" >';
// query posts section
$args = array('post_type' => 'portfolio', 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
if (!empty($settings['category']) || !empty($settings['tag']) && $settings['portfolio-filter'] == 'disable') {
$args['tax_query'] = array('relation' => 'OR');
if (!empty($settings['category'])) {
array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'portfolio_category', 'field' => 'slug'));
}
if (!empty($settings['tag']) && $settings['portfolio-filter'] == 'disable') {
array_push($args['tax_query'], array('terms' => explode(',', $settings['tag']), 'taxonomy' => 'portfolio_tag', 'field' => 'slug'));
}
}
$query = new WP_Query($args);
// create the portfolio filter
$settings['portfolio-size'] = str_replace('1/', '', $settings['portfolio-size']);
if ($settings['portfolio-filter'] == 'enable') {
// ajax infomation
$ret .= '<div class="gdlr-ajax-info" data-num-fetch="' . $args['posts_per_page'] . '" ';
$ret .= 'data-orderby="' . $args['orderby'] . '" data-order="' . $args['order'] . '" ';
$ret .= 'data-thumbnail-size="' . $settings['thumbnail-size'] . '" data-port-style="' . $settings['portfolio-style'] . '" ';
$ret .= 'data-port-size="' . $settings['portfolio-size'] . '" data-port-layout="' . $settings['portfolio-layout'] . '" ';
$ret .= 'data-ajax="' . admin_url('admin-ajax.php') . '" data-category="' . $settings['category'] . '" ></div>';
// category filter
if (empty($settings['category'])) {
$parent = array('gdlr-all' => __('All', 'gdlr-portfolio'));
$settigns['category-id'] = '';
} else {
$term = get_term_by('slug', $settings['category'], 'portfolio_category');
$parent = array($settings['category'] => $term->name);
$settings['category-id'] = $term->term_id;
}
$filters = $parent + gdlr_get_term_list('portfolio_category', $settings['category-id']);
$filter_active = 'active';
$ret .= '<div class="portfolio-item-filter">';
foreach ($filters as $filter_id => $filter) {
$filter_id = $filter_id == 'gdlr-all' ? '' : $filter_id;
$ret .= '<a class="' . $filter_active . '" href="#" ';
$ret .= 'data-category="' . $filter_id . '" ><span class="sep">/</span>' . $filter . '</a>';
$filter_active = '';
}
$ret .= '</div>';
}
$no_space = strpos($settings['portfolio-style'], 'no-space') > 0 ? 'gdlr-item-no-space' : '';
$no_space .= ' gdlr-portfolio-column-' . $settings['portfolio-size'];
$ret .= '<div class="portfolio-item-holder ' . $no_space . '">';
if ($settings['portfolio-style'] == 'classic-portfolio' || $settings['portfolio-style'] == 'classic-portfolio-no-space') {
$ret .= gdlr_get_classic_portfolio($query, $settings['portfolio-size'], $settings['thumbnail-size'], $settings['portfolio-layout']);
} else {
if ($settings['portfolio-style'] == 'modern-portfolio' || $settings['portfolio-style'] == 'modern-portfolio-no-space') {
$ret .= gdlr_get_modern_portfolio($query, $settings['portfolio-size'], $settings['thumbnail-size'], $settings['portfolio-layout']);
}
}
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// create pagination
if ($settings['portfolio-filter'] == 'enable' && $settings['pagination'] == 'enable') {
$ret .= gdlr_get_ajax_pagination($query->max_num_pages, $args['paged']);
} else {
if ($settings['pagination'] == 'enable') {
$ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
}
$ret .= '</div>';
// portfolio-item-wrapper
return $ret;
}
示例3: get_query_var
</div>
<div class="pdf one columns">
<?php
if (!$pdf == '') {
echo '<a href="' . $pdf . '" class="button red">
<i class="fa fa-file-pdf-o fa-inverse"></i>
</a>';
} else {
?>
<span class="button red inactive"><i class="fa fa-file-pdf-o fa-inverse"></i></span><?php
}
?>
</div>
</div>
<?php
}
//end while
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
echo gdlr_get_pagination($full_list_query->max_num_pages, $paged);
}
wp_reset_postdata();
/* Restore original Post Data */
?>
</div>
</div>
</div>
</div>
<?php
}
//end while
示例4: gdlr_print_room_item
function gdlr_print_room_item($settings = array())
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
// query posts section
$args = array('post_type' => 'room', 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
if (!empty($settings['category']) || !empty($settings['tag'])) {
$args['tax_query'] = array('relation' => 'OR');
if (!empty($settings['category'])) {
array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'room_category', 'field' => 'slug'));
}
if (!empty($settings['tag'])) {
array_push($args['tax_query'], array('terms' => explode(',', $settings['tag']), 'taxonomy' => 'room_tag', 'field' => 'slug'));
}
}
$query = new WP_Query($args);
$no_space = strpos($settings['room-style'], 'no-space') > 0 ? 'gdlr-item-no-space' : '';
$settings['room-style'] = str_replace('-no-space', '', $settings['room-style']);
if (($settings['room-style'] == 'classic' || $settings['room-style'] == 'modern') && !empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') {
$settings['carousel'] = true;
}
$ret = gdlr_get_item_title($settings);
$ret .= '<div class="room-item-wrapper type-' . $settings['room-style'] . '" ' . $item_id . $margin_style . '>';
$ret .= '<div class="room-item-holder ' . $no_space . '">';
if ($settings['room-style'] == 'medium') {
global $gdlr_excerpt_length, $gdlr_excerpt_read_more, $gdlr_excerpt_word;
$gdlr_excerpt_read_more = false;
$gdlr_excerpt_length = $settings['num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
$ret .= gdlr_get_medium_room($query, $settings['thumbnail-size']);
$gdlr_excerpt_word = '';
$gdlr_excerpt_read_more = true;
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
} else {
if ($settings['room-style'] == 'classic') {
if (!empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') {
$ret .= gdlr_get_classic_room_carousel($query, $settings['room-size'], $settings['thumbnail-size']);
} else {
$ret .= gdlr_get_classic_room($query, $settings['room-size'], $settings['thumbnail-size']);
}
} else {
if ($settings['room-style'] == 'modern') {
if (!empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') {
$ret .= gdlr_get_modern_room_carousel($query, $settings['room-size'], $settings['thumbnail-size']);
} else {
$ret .= gdlr_get_modern_room($query, $settings['room-size'], $settings['thumbnail-size']);
}
}
}
}
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
if ($settings['pagination'] == 'enable') {
$ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
$ret .= '</div>';
// room-item-wrapper
return $ret;
}
示例5: gdlr_get_page_list_item
function gdlr_get_page_list_item($settings)
{
if (function_exists('gdlr_include_portfolio_scirpt')) {
gdlr_include_portfolio_scirpt();
}
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$settings['title-type'] = empty($settings['title-type']) ? 'none' : $settings['title-type'];
$settings['title'] = empty($settings['title']) ? '' : $settings['title'];
$settings['caption'] = empty($settings['caption']) ? '' : $settings['caption'];
$settings['icon'] = empty($settings['icon']) ? '' : $settings['icon'];
$ret .= gdlr_get_item_title(array('title' => $settings['title'], 'caption' => $settings['caption'], 'icon' => $settings['icon'], 'type' => $settings['title-type']));
$ret .= '<div class="portfolio-item-wrapper type-' . $settings['page-style'] . '" ' . $item_id . $margin_style . '>';
// query section
$args = array('post_type' => 'page', 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = 'menu_order';
$args['order'] = 'asc';
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
if (!empty($settings['category'])) {
$args['tax_query'] = array(array('terms' => explode(',', $settings['category']), 'taxonomy' => 'page_category', 'field' => 'slug'));
}
$query = new WP_Query($args);
// print item section
$settings['item-size'] = str_replace('1/', '', $settings['item-size']);
$ret .= '<div class="portfolio-item-holder">';
if ($settings['page-style'] == 'classic') {
$ret .= gdlr_get_classic_page_list($query, $settings['item-size'], $settings['thumbnail-size'], $settings['page-layout']);
} else {
if ($settings['page-style'] == 'modern') {
$ret .= gdlr_get_modern_page_list($query, $settings['item-size'], $settings['thumbnail-size'], $settings['page-layout']);
}
}
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
if ($settings['pagination'] == 'enable') {
$ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
$ret .= '</div>';
// portfolio-item-wrapper
return $ret;
}
示例6: gdlr_get_gallery
function gdlr_get_gallery($settings)
{
global $gdlr_gallery_id, $gdlr_spaces;
$gdlr_gallery_id++;
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
// start printing gallery
$current_size = 0;
$settings['num-fetch'] = empty($settings['num-fetch']) ? 9999 : intval($settings['num-fetch']);
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$num_page = ceil(sizeof($settings['slider']) / $settings['num-fetch']);
$ret = '<div class="gdlr-gallery-item gdlr-item" ' . $item_id . $margin_style . '>';
foreach ($settings['slider'] as $slide_id => $slide) {
if ($current_size >= ($paged - 1) * $settings['num-fetch'] && $current_size < $paged * $settings['num-fetch']) {
if (!empty($current_size) && $current_size % $settings['gallery-columns'] == 0) {
$ret .= '<div class="clear"></div>';
}
$ret .= '<div class="gallery-column ' . gdlr_get_column_class('1/' . $settings['gallery-columns']) . '">';
$ret .= '<div class="gallery-item">';
if (empty($slide['slide-link']) || $slide['slide-link'] == 'none') {
$ret .= gdlr_get_image($slide_id, $settings['thumbnail-size']);
} else {
if ($slide['slide-link'] == 'url' || $slide['slide-link'] == 'attachment') {
$ret .= gdlr_get_image($slide_id, $settings['thumbnail-size'], array('url' => $slide['url'], 'new-tab' => $slide['new-tab']));
} else {
if ($slide['slide-link'] == 'current') {
$ret .= gdlr_get_image($slide_id, $settings['thumbnail-size'], array('id' => $gdlr_gallery_id));
} else {
if ($slide['slide-link'] == 'image') {
$ret .= gdlr_get_image($slide_id, $settings['thumbnail-size'], array('url' => $slide['url'], 'id' => $gdlr_gallery_id));
} else {
if ($slide['slide-link'] == 'video') {
$ret .= gdlr_get_image($slide_id, $settings['thumbnail-size'], array('url' => $slide['url'], 'type' => 'video', 'id' => $gdlr_gallery_id));
}
}
}
}
}
if ($settings['show-caption'] != 'no') {
$ret .= '<span class="gallery-caption">' . gdlr_get_attachment_info($slide_id, 'caption') . '</span>';
}
$ret .= '</div>';
// gallery item
$ret .= '</div>';
// gallery column
}
$current_size++;
}
$ret .= '<div class="clear"></div>';
$ret .= gdlr_get_pagination($num_page, $paged);
$ret .= '</div>';
// gdlr-gallery-item
return $ret;
}
示例7: gdlr_get_blog_item
function gdlr_get_blog_item($settings = array())
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$settings['title-type'] = empty($settings['title-type']) ? 'none' : $settings['title-type'];
$settings['title'] = empty($settings['title']) ? '' : $settings['title'];
$settings['caption'] = empty($settings['caption']) ? '' : $settings['caption'];
$settings['icon'] = empty($settings['icon']) ? '' : $settings['icon'];
$right_text = '';
$right_text_class = '';
$settings['right-text'] = empty($settings['right-text']) ? '' : $settings['right-text'];
$settings['right-text-link'] = empty($settings['right-text-link']) ? '' : $settings['right-text-link'];
if (!empty($settings['right-text-link'])) {
$right_text_class = 'gdlr-right-text ';
$right_text = '<a class="gdlr-right-text-link" href="' . $settings['right-text-link'] . '" >' . $settings['right-text'] . '</a>';
}
if ($settings['blog-layout'] == 'carousel') {
$carousel = true;
$right_text_class .= 'gdlr-nav-container ';
}
$ret = gdlr_get_item_title(array('title' => $settings['title'], 'caption' => $settings['caption'], 'icon' => $settings['icon'], 'type' => $settings['title-type'], 'carousel' => $carousel, 'additional_class' => $right_text_class, 'additional_html' => $right_text));
$ret .= '<div class="blog-item-wrapper" ' . $item_id . $margin_style . '>';
// query post and sticky post
$args = array('post_type' => 'post', 'suppress_filters' => false);
if (!empty($settings['category']) || !empty($settings['tag'])) {
$args['tax_query'] = array('relation' => 'OR');
if (!empty($settings['category'])) {
array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'category', 'field' => 'slug'));
}
if (!empty($settings['tag'])) {
array_push($args['tax_query'], array('terms' => explode(',', $settings['tag']), 'taxonomy' => 'post_tag', 'field' => 'slug'));
}
}
if ($settings['enable-sticky'] == 'enable') {
if (get_query_var('paged') <= 1) {
$sticky_args = $args;
$sticky_args['post__in'] = get_option('sticky_posts');
if (!empty($sticky_args['post__in'])) {
$sticky_query = new WP_Query($sticky_args);
}
}
$args['post__not_in'] = get_option('sticky_posts', '');
} else {
$args['ignore_sticky_posts'] = 1;
}
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : get_query_var('page');
$args['paged'] = empty($args['paged']) ? 1 : $args['paged'];
$args['offset'] = empty($settings['offset']) ? 0 : $settings['offset'];
$query = new WP_Query($args);
// merge query
if (!empty($sticky_query)) {
$query->posts = array_merge($sticky_query->posts, $query->posts);
$query->post_count = $sticky_query->post_count + $query->post_count;
}
// set the excerpt length
if (!empty($settings['num-excerpt'])) {
global $gdlr_excerpt_length;
$gdlr_excerpt_length = $settings['num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
}
// get blog by the blog style
global $gdlr_post_settings, $gdlr_lightbox_id;
$gdlr_lightbox_id++;
$gdlr_post_settings['excerpt'] = intval($settings['num-excerpt']);
$gdlr_post_settings['thumbnail-size'] = $settings['thumbnail-size'];
$gdlr_post_settings['blog-style'] = $settings['blog-style'];
$ret .= '<div class="blog-item-holder">';
if ($settings['blog-style'] == 'blog-full') {
$gdlr_post_settings['blog-info'] = array('date', 'author', 'comment', 'category');
$ret .= gdlr_get_blog_full($query);
} else {
if ($settings['blog-style'] == 'blog-medium') {
$gdlr_post_settings['blog-info'] = array('date', 'author', 'comment', 'category');
$ret .= gdlr_get_blog_medium($query);
} else {
if ($settings['blog-style'] == 'blog-grid-list') {
$gdlr_post_settings['blog-info'] = array('date', 'author');
$ret .= gdlr_get_blog_grid_list($query, $blog_size, $settings['blog-layout']);
} else {
$gdlr_post_settings['blog-info'] = array('date', 'author');
$blog_size = str_replace('blog-1-', '', $settings['blog-style']);
$ret .= gdlr_get_blog_grid($query, $blog_size, $settings['blog-layout']);
}
}
}
$ret .= '</div>';
if ($settings['pagination'] == 'enable') {
$ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
$ret .= '</div>';
// blog-item-wrapper
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
return $ret;
}
示例8: gdlr_print_cause_item
function gdlr_print_cause_item($settings = array())
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces, $gdlr_excerpt_read_more;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
$settings['title-type'] = empty($settings['title-type']) ? 'none' : $settings['title-type'];
$settings['title'] = empty($settings['title']) ? '' : $settings['title'];
$settings['caption'] = empty($settings['caption']) ? '' : $settings['caption'];
$settings['icon'] = empty($settings['icon']) ? '' : $settings['icon'];
$right_text = '';
$right_text_class = '';
$carousel = false;
$settings['right-text'] = empty($settings['right-text']) ? '' : $settings['right-text'];
$settings['right-text-link'] = empty($settings['right-text-link']) ? '' : $settings['right-text-link'];
if (!empty($settings['right-text-link']) && !empty($settings['right-text'])) {
$right_text_class = 'gdlr-right-text ';
$right_text .= '<a class="gdlr-right-text-link" href="' . $settings['right-text-link'] . '" >' . $settings['right-text'] . '</a>';
}
if ($settings['cause-style'] == 'grid' && $settings['cause-layout'] == 'carousel') {
$carousel = true;
$right_text_class .= 'gdlr-nav-container ';
}
$ret = gdlr_get_item_title(array('title' => $settings['title'], 'caption' => $settings['caption'], 'icon' => $settings['icon'], 'type' => $settings['title-type'], 'carousel' => $carousel, 'additional_class' => $right_text_class, 'additional_html' => $right_text));
$ret .= '<div class="cause-item-wrapper" ' . $item_id . $margin_style . ' >';
// query posts section
$args = array('post_type' => 'cause', 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
if ($settings['orderby'] == 'nearly') {
$args['meta_key'] = 'gdlr-donation-percent';
$args['meta_compare'] = '>';
$args['meta_value'] = '100';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'desc';
} else {
if ($settings['orderby'] == 'finish') {
$args['meta_key'] = 'gdlr-donation-percent';
$args['meta_compare'] = '=';
$args['meta_value'] = '100';
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
} else {
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
}
}
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
if (!empty($settings['category'])) {
$args['tax_query'] = array(array('terms' => explode(',', $settings['category']), 'taxonomy' => 'cause_category', 'field' => 'slug'));
}
$query = new WP_Query($args);
// excerpt number
if (!empty($settings['num-excerpt'])) {
global $gdlr_excerpt_length;
$gdlr_excerpt_length = $settings['num-excerpt'];
add_filter('excerpt_length', 'gdlr_set_excerpt_length');
}
$ret .= '<div class="cause-item-holder">';
if ($settings['cause-style'] == 'grid') {
$gdlr_excerpt_read_more = false;
$settings['cause-size'] = str_replace('1/', '', $settings['cause-size']);
$ret .= gdlr_get_cause_grid($query, $settings['cause-size'], $settings['thumbnail-size'], $settings['cause-layout'], $settings['num-excerpt']);
$gdlr_excerpt_read_more = true;
} else {
if ($settings['cause-style'] == 'medium') {
$ret .= gdlr_get_cause_medium($query, $settings['thumbnail-size'], $settings['num-excerpt']);
} else {
if ($settings['cause-style'] == 'full') {
$ret .= gdlr_get_cause_full($query, $settings['thumbnail-size'], $settings['num-excerpt']);
}
}
}
$ret .= '<div class="clear"></div>';
$ret .= '</div>';
// create pagination
if ($settings['pagination'] == 'enable') {
$ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
remove_filter('excerpt_length', 'gdlr_set_excerpt_length');
$ret .= '</div>';
// cause-item-wrapper
return $ret;
}
示例9: gdlr_print_player_item
function gdlr_print_player_item($settings)
{
$item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
global $gdlr_spaces;
$margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
$margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
// query posts section
$args = array('post_type' => 'player', 'suppress_filters' => false);
$args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch'];
$args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby'];
$args['order'] = empty($settings['order']) ? 'desc' : $settings['order'];
$args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
$selected_category = $settings['category'];
if ($settings['player-layout'] == 'carousel') {
$settings['carousel'] = true;
}
echo '<div class="player-item-wrapper" ' . $item_id . $margin_style . ' data-ajax="' . AJAX_URL . '" >';
echo gdlr_get_item_title($settings);
// create the player filter
if ($settings['player-filter'] == 'enable') {
// ajax infomation
echo '<div class="gdlr-ajax-info" data-num-fetch="' . $args['posts_per_page'] . '" ';
echo 'data-orderby="' . $args['orderby'] . '" data-order="' . $args['order'] . '" data-pagination="' . $settings['pagination'] . '" ';
echo 'data-thumbnail-size="' . $settings['thumbnail-size'] . '" data-player-style="' . $settings['player-style'] . '" ';
echo 'data-player-size="' . $settings['player-size'] . '" data-player-layout="' . $settings['player-layout'] . '" ';
echo 'data-ajax="' . admin_url('admin-ajax.php') . '" data-category="' . $settings['category'] . '" ></div>';
// category filter
if (empty($settings['category'])) {
$parent = array('gdlr-all' => __('All', 'gdlr-soccer'));
$settings['category-id'] = '';
} else {
$term = get_term_by('slug', $settings['category'], 'player_category');
$parent = array($settings['category'] => $term->name);
$settings['category-id'] = $term->term_id;
}
//$filters = $parent + gdlr_get_term_list('player_category', $settings['category-id']);
$filters = gdlr_get_term_list('player_category', $settings['category-id']);
$filter_category = empty($_GET['player-filter']) ? '' : $_GET['player-filter'];
echo '<div class="player-item-filter">';
foreach ($filters as $filter_id => $filter) {
$filter_id = $filter_id == 'gdlr-all' ? '' : $filter_id;
echo '<span class="gdlr-saperator">|</span>';
if (empty($filter_category)) {
$filter_category = 'gdlr-player-selected';
$selected_category = $filter_id;
echo '<a class="gdlr-title-font active" href="#" ';
} else {
if ($filter_category != 'gdlr-player-selected' && $filter_category == $filter_id) {
$selected_category = $filter_id;
echo '<a class="gdlr-title-font active" href="#" ';
} else {
echo '<a class="gdlr-title-font" href="#" ';
}
}
echo 'data-category="' . $filter_id . '" >' . $filter . '</a>';
}
echo '</div>';
}
if (!empty($selected_category)) {
$args['tax_query'] = array(array('terms' => explode(',', $selected_category), 'taxonomy' => 'player_category', 'field' => 'slug'));
}
$query = new WP_Query($args);
echo '<div class="player-item-holder">';
if ($settings['player-style'] == 'classic') {
gdlr_print_classic_player($query, $settings['player-size'], $settings['thumbnail-size'], $settings['player-layout']);
} else {
if ($settings['player-style'] == 'modern') {
gdlr_print_modern_player($query, $settings['player-size'], $settings['thumbnail-size'], $settings['player-layout']);
}
}
echo '<div class="clear"></div>';
echo '</div>';
// create pagination
if ($settings['player-filter'] == 'enable' && $settings['pagination'] == 'enable') {
echo gdlr_get_ajax_pagination($query->max_num_pages, $args['paged']);
} else {
if ($settings['pagination'] == 'enable') {
echo gdlr_get_pagination($query->max_num_pages, $args['paged']);
}
}
echo '</div>';
// player item wrapper
}