本文整理汇总了PHP中dt_get_paged_var函数的典型用法代码示例。如果您正苦于以下问题:PHP dt_get_paged_var函数的具体用法?PHP dt_get_paged_var怎么用?PHP dt_get_paged_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_get_paged_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_pagination
protected function do_pagination($query)
{
if (is_wp_error($query)) {
return;
}
$paged = dt_get_paged_var();
$this->response['nextPage'] = dt_get_next_posts_url($query->max_num_pages) ? $paged + 1 : 0;
$load_style = $this->config->get('load_style');
if (presscore_is_load_more_pagination()) {
$pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
if ($pagination) {
$this->response['currentPage'] = $paged;
$this->response['paginationHtml'] = $pagination;
} else {
$this->response['currentPage'] = $this->input['post_paged'];
}
$this->response['paginationType'] = 'more';
} else {
if ('ajax_pagination' == $load_style) {
ob_start();
dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
$pagination = ob_get_clean();
if ($pagination) {
$this->response['paginationHtml'] = $pagination;
}
$this->response['paginationType'] = 'paginator';
}
}
}
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:29,代码来源:abstract-presscore-ajax-content-builder.php
示例2: get_posts_by_terms
public function get_posts_by_terms($args = array())
{
$defaults = array('post_type' => 'post', 'taxonomy' => 'category', 'terms' => null, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => 10, 'post__in' => null, 'post__not_in' => null, 'select' => 'all', 'no_found_rows' => false);
$args = wp_parse_args($args, $defaults);
if (!$this->verify_args($args)) {
return new WP_Query();
}
$query_args = array('post_type' => $args['post_type'], 'order' => $args['order'], 'no_found_rows' => $args['no_found_rows'], 'orderby' => 'name' == $args['orderby'] ? 'title' : $args['orderby'], 'paged' => dt_get_paged_var(), 'post_status' => 'publish');
if ($args['posts_per_page']) {
$query_args['posts_per_page'] = $args['posts_per_page'];
}
if ($args['post__in']) {
$query_args['post__in'] = $args['post__in'];
}
if ($args['post__not_in']) {
$query_args['post__not_in'] = $args['post__not_in'];
}
// construct base tax_query if not all terms slected
if (in_array($args['select'], array('only', 'except')) && !empty($args['terms']) && is_array($args['terms'])) {
// get all terms ids
$all_terms = wp_list_pluck(get_categories(array('type' => $args['post_type'], 'taxonomy' => $args['taxonomy'], 'pad_counts' => false, 'hide_empty' => 1, 'hierarchical' => 0)), 'term_id');
// sanitize terms
$terms = array_values($args['terms']);
// ONLY tax_query
if ('only' == $args['select']) {
$operator = 'IN';
if (0 == $terms[0]) {
$terms = $all_terms;
$operator = 'NOT IN';
}
$query_args['tax_query'] = array(array('taxonomy' => $args['taxonomy'], 'terms' => $terms, 'operator' => $operator, 'field' => 'id'));
// EXCEPT tax_query
} else {
if ('except' == $args['select']) {
$in_terms = array_diff($all_terms, $terms);
sort($in_terms);
if ($in_terms) {
$query_args['tax_query'] = array('relation' => 'OR', array('taxonomy' => $args['taxonomy'], 'terms' => $in_terms, 'operator' => 'IN', 'field' => 'id'), array('taxonomy' => $args['taxonomy'], 'terms' => $terms, 'operator' => 'NOT IN', 'field' => 'id'));
add_filter('posts_clauses', 'dt_core_join_left_filter');
}
}
}
}
$page_query = new WP_Query($query_args);
remove_filter('posts_clauses', 'dt_core_join_left_filter');
return $page_query;
}
示例3: presscore_mod_albums_get_photos
/**
* @return WP_Query Album photos query.
*/
function presscore_mod_albums_get_photos()
{
$albums_query = presscore_get_filtered_posts(array('post_type' => 'dt_gallery', 'taxonomy' => 'dt_gallery_category', 'posts_per_page' => -1));
$media_items = array(0);
if ($albums_query->have_posts()) {
$media_items = array();
foreach ($albums_query->posts as $gallery) {
$gallery_media = get_post_meta($gallery->ID, '_dt_album_media_items', true);
if (is_array($gallery_media)) {
$media_items = array_merge($media_items, $gallery_media);
}
}
}
$media_items = array_unique($media_items);
$attachments_args = array('post__in' => $media_items, 'orderby' => 'post__in', 'no_found_rows' => false, 'paged' => dt_get_paged_var());
$posts_per_page = presscore_config()->get('posts_per_page');
if ($posts_per_page) {
$attachments_args['posts_per_page'] = $posts_per_page;
}
return presscore_query()->get_attachments($attachments_args);
}
示例4: presscore_masonry_container_data_atts
/**
* [presscore_masonry_container_data_atts description]
*
* @since 1.0.0
*
* @return satring [description]
*/
function presscore_masonry_container_data_atts()
{
$config = Presscore_Config::get_instance();
$data_atts = array('data-padding="' . intval($config->get('item_padding')) . 'px"', 'data-cur-page="' . dt_get_paged_var() . '"');
if ($config->get('hide_last_row')) {
$data_atts[] = 'data-part-row="false"';
}
$target_height = $config->get('target_height');
if (null !== $target_height) {
$data_atts[] = 'data-target-height="' . absint($target_height) . 'px"';
}
$target_width = $config->get('post.preview.width.min');
if (null !== $target_width) {
$data_atts[] = 'data-width="' . absint($target_width) . 'px"';
}
$columns = $config->get('template.columns.number');
if (null !== $columns) {
$data_atts[] = 'data-columns="' . absint($columns) . '"';
}
return ' ' . implode(' ', $data_atts);
}
示例5: get_categories
<?php
if (!post_password_required()) {
?>
<?php
$ppp = $config->get('posts_per_page');
$order = $config->get('order');
$orderby = $config->get('orderby');
$display = $config->get('display');
$request_display = $config->get('request_display');
$all_terms = get_categories(array('type' => 'dt_portfolio', 'hide_empty' => 1, 'hierarchical' => 0, 'taxonomy' => 'dt_portfolio_category', 'pad_counts' => false));
$all_terms_array = array();
foreach ($all_terms as $term) {
$all_terms_array[] = $term->term_id;
}
$page_args = array('post_type' => 'dt_portfolio', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $order, 'orderby' => $orderby);
if ($ppp) {
$page_args['posts_per_page'] = intval($ppp);
}
if ('all' != $display['select'] && !empty($display['terms_ids'])) {
$page_args['tax_query'] = array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'term_id', 'terms' => array_values($display['terms_ids']), 'operator' => 'IN'));
if ('except' == $display['select']) {
$terms_arr = array_diff($all_terms_array, $display['terms_ids']);
sort($terms_arr);
if ($terms_arr) {
$page_args['tax_query']['relation'] = 'OR';
$page_args['tax_query'][1] = $page_args['tax_query'][0];
$page_args['tax_query'][0]['terms'] = $terms_arr;
$page_args['tax_query'][1]['operator'] = 'NOT IN';
}
add_filter('posts_clauses', 'dt_core_join_left_filter');
示例6: dt_get_next_page_button
/**
* Next page button.
*
*/
function dt_get_next_page_button($max, $class = '')
{
$next_posts_link = dt_get_next_posts_url($max);
if ($next_posts_link) {
$icon = '<svg class="loading-icon" viewBox="0 0 48 48" ><path d="M23.98,0.04c-13.055,0-23.673,10.434-23.973,23.417C0.284,12.128,8.898,3.038,19.484,3.038c10.76,0,19.484,9.395,19.484,20.982c0,2.483,2.013,4.497,4.496,4.497c2.482,0,4.496-2.014,4.496-4.497C47.96,10.776,37.224,0.04,23.98,0.04z M23.98,48c13.055,0,23.673-10.434,23.972-23.417c-0.276,11.328-8.89,20.42-19.476,20.42 c-10.76,0-19.484-9.396-19.484-20.983c0-2.482-2.014-4.496-4.497-4.496C2.014,19.524,0,21.537,0,24.02C0,37.264,10.736,48,23.98,48z"/></svg>';
return '<div class="' . esc_attr($class) . '">
<a class="button-load-more" href="javascript: void(0);" data-dt-page="' . dt_get_paged_var() . '" >' . $icon . '<span class="button-caption">' . __('Load more', LANGUAGE_ZONE) . '</span></a>
</div>';
}
return '';
}
示例7: implode
case 'on_dark_gradient':
$masonry_container_classes[] = 'hover-style-one';
if ('always' == $config->get('hover_content_visibility')) {
$masonry_container_classes[] = 'always-show-info';
}
break;
case 'from_bottom':
$masonry_container_classes[] = 'hover-style-three';
$masonry_container_classes[] = 'cs-style-3';
if ('always' == $config->get('hover_content_visibility')) {
$masonry_container_classes[] = 'always-show-info';
}
break;
}
$masonry_container_classes = implode(' ', $masonry_container_classes);
$masonry_container_data_attr = array('data-padding="' . intval($item_padding) . 'px"', 'data-target-height="' . intval($target_height) . 'px"', 'data-cur-page="' . dt_get_paged_var() . '"');
if ($config->get('hide_last_row')) {
$masonry_container_data_attr[] = 'data-part-row="false"';
}
// ninjaaaa!
$masonry_container_data_attr = ' ' . implode(' ', $masonry_container_data_attr);
?>
<?php
if ($full_width) {
?>
<div class="full-width-wrap">
<?php
}
示例8: dt_get_next_page_button
/**
* Next page button.
*
*/
function dt_get_next_page_button($max, $class = '')
{
$next_posts_link = dt_get_next_posts_url($max);
if ($next_posts_link) {
$button_html_class = 'button-load-more';
if (presscore_is_lazy_loading()) {
$button_html_class .= ' button-lazy-loading';
$caption = __('Loading...', 'the7mk2');
} else {
$caption = __('Load more', 'the7mk2');
}
$caption = apply_filters('dt_get_next_page_button-caption', $caption);
$icon = '<span class="stick"></span><span class="stick"></span><span class="stick"></span>';
return '<div class="' . esc_attr($class) . '">
<a class="' . $button_html_class . '" href="javascript: void(0);" data-dt-page="' . dt_get_paged_var() . '" >' . $icon . '<span class="h5-size button-caption">' . $caption . '</span></a>
</div>';
}
return '';
}
示例9: dt_storage
<?php
/* Template Name: 15. Homepage with Blog */
dt_storage('is_homepage', dt_get_paged_var() <= 1);
dt_storage('is_blog', true);
dt_storage('have_sidebar', true);
do_action('dt_layout_before_header-blog');
get_header();
?>
<?php
get_template_part('top-bg');
?>
<?php
get_template_part('nav');
?>
<?php
$slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
?>
<?php
if (dt_storage('is_homepage')) {
if ('fullscreen_slider' == $slider_options['slider']) {
$slider_section_id = 'fs-slideshow';
} else {
$slider_section_id = 'slide';
}
?>
<section id="<?php
示例10: do_action
?>
<?php
do_action('presscore_before_loop');
?>
<?php
$full_width = $config->get('full_width');
$item_padding = $config->get('item_padding');
$target_width = $config->get('target_width');
$ppp = $config->get('posts_per_page');
$order = $config->get('order');
$orderby = $config->get('orderby');
$display = $config->get('display');
$layout = $config->get('layout');
$blog_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $order, 'orderby' => 'name' == $orderby ? 'title' : $orderby);
if ($ppp) {
$blog_args['posts_per_page'] = intval($ppp);
}
if (!empty($display['terms_ids'])) {
$terms_ids = array_values($display['terms_ids']);
switch ($display['select']) {
case 'only':
$blog_args['category__in'] = $terms_ids;
break;
case 'except':
$blog_args['category__not_in'] = $terms_ids;
}
}
$blog_query = new WP_Query($blog_args);
// masonry layout
示例11: presscore_body_class
/**
* Add theme speciffik classes to body.
*
* @since presscore 1.0
*/
function presscore_body_class( $classes ) {
global $post;
$config = Presscore_Config::get_instance();
$desc_on_hoover = ( 'under_image' != $config->get('description') );
$template = $config->get('template');
$layout = $config->get('layout');
// template classes
switch ( $template ) {
case 'blog':
$classes[] = 'blog';
if ( !of_get_option( 'general-blog_meta_postformat', 1 ) ) {
$classes[] = 'post-format-icons-disabled';
}
break;
case 'portfolio': $classes[] = 'portfolio'; break;
case 'team': $classes[] = 'team'; break;
case 'testimonials': $classes[] = 'testimonials'; break;
case 'archive': $classes[] = 'archive'; break;
case 'search': $classes[] = 'search'; break;
case 'albums': $classes[] = 'albums'; break;
case 'media': $classes[] = 'media'; break;
case 'microsite': $classes[] = 'one-page-row'; break;
}
// layout classes
switch ( $layout ) {
case 'masonry':
if ( $desc_on_hoover ) {
$classes[] = 'layout-masonry-grid';
} else {
$classes[] = 'layout-masonry';
}
break;
case 'grid':
$classes[] = 'layout-grid';
if ( $desc_on_hoover ) {
$classes[] = 'grid-text-hovers';
}
break;
case 'checkerboard':
case 'list': $classes[] = 'layout-list'; break;
}
// hover classes
if ( in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team')) ) {
$classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image';
}
// hide dividers if content is off
if ( in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout') ) {
$show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links');
if ( !$show_dividers ) $classes[] = 'description-off';
}
if ( is_single() ) {
$post_type = get_post_type();
if ( 'dt_portfolio' == $post_type && ( post_password_required() || ( !comments_open() && '0' == get_comments_number() ) ) ) {
$classes[] = 'no-comments';
} else if ( 'post' == $post_type && !of_get_option( 'general-blog_meta_postformat', 1 ) ) {
$classes[] = 'post-format-icons-disabled';
}
}
if ( in_array('single-dt_portfolio', $classes) ) {
$key = array_search('single-dt_portfolio', $classes);
$classes[ $key ] = 'single-portfolio';
}
switch ( $config->get('header_background') ) {
case 'overlap': $classes['header_background'] = 'overlap'; break;
case 'transparent': $classes['header_background'] = 'transparent';
}
if ( 'fancy' == $config->get( 'header_title' ) ) {
$classes[] = 'fancy-header-on';
} elseif ( 'slideshow' == $config->get( 'header_title' ) ) {
$classes[] = 'slideshow-on';
if ( '3d' == $config->get( 'slideshow_mode' ) && 'fullscreen-content' == $config->get( 'slideshow_3d_layout' ) ) {
$classes[] = 'threed-fullscreen';
}
if ( dt_get_paged_var() > 1 && isset($classes['header_background']) ) {
unset($classes['header_background']);
}
} elseif ( is_single() && 'disabled' == $config->get( 'header_title' ) ) {
$classes[] = 'title-off';
}
// hoover style
//.........这里部分代码省略.........
示例12: presscore_get_categorizer_sorting_fields
/**
* Get Categorizer sorting fields.
*
* @since 1.0.0
*/
function presscore_get_categorizer_sorting_fields()
{
$config = presscore_get_config();
$show_orderby = $config->get('template.posts_filter.orderby.enabled');
$show_order = $config->get('template.posts_filter.order.enabled');
// if filter or all sorting buttons disabled - return empty string
if (!$show_orderby && !$show_order) {
return '';
}
$request_display = $config->get('request_display');
if (null !== $request_display) {
$display = $request_display;
} else {
$display = $config->get('display');
$display['select'] = 'all';
}
$select = isset($display['select']) ? $display['select'] : 'all';
$term_id = isset($display['terms_ids']) ? current((array) $display['terms_ids']) : array();
$term = '';
if ('except' == $select && 0 === $term_id) {
$term = 'none';
} else {
if ('only' == $select) {
$term = absint($term_id);
}
}
$paged = dt_get_paged_var();
if ($paged > 1) {
$base_link = get_pagenum_link($paged, false);
} else {
$base_link = get_permalink();
}
//////////////
// output //
//////////////
$link = add_query_arg('term', $term, $base_link);
$act = ' act';
$display_none = ' style="display: none;"';
$orderby = $config->get('orderby');
$order = $config->get('order');
$html = '<div class="filter-extras">' . "\n" . '<div class="filter-by"' . ($show_orderby ? '' : $display_none) . '>' . "\n" . '<a href="' . esc_url(add_query_arg(array('orderby' => 'date', 'order' => $order), $link)) . '" class="sort-by-date' . ('date' == $orderby ? $act : '') . '" data-by="date">' . __('Date', 'the7mk2') . '</a>' . "\n" . '<span class="filter-switch"></span>' . '<a href="' . esc_url(add_query_arg(array('orderby' => 'name', 'order' => $order), $link)) . '" class="sort-by-name' . ('name' == $orderby ? $act : '') . '" data-by="name">' . __('Name', 'the7mk2') . '</a>' . "\n" . '</div>' . "\n" . '<div class="filter-sorting"' . ($show_order ? '' : $display_none) . '>' . "\n" . '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'DESC'), $link)) . '" class="sort-by-desc' . ('DESC' == $order ? $act : '') . '" data-sort="desc">' . __('Desc', 'the7mk2') . '</a>' . '<span class="filter-switch"></span>' . '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'ASC'), $link)) . '" class="sort-by-asc' . ('ASC' == $order ? $act : '') . '" data-sort="asc">' . __('Asc', 'the7mk2') . '</a>' . '</div>' . "\n" . '</div>' . "\n";
return $html;
}
示例13: presscore_get_blog_query
function presscore_get_blog_query()
{
$config = presscore_get_config();
$orderby = $config->get('orderby');
$query_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $config->get('order'), 'orderby' => 'name' == $orderby ? 'title' : $orderby);
$ppp = $config->get('posts_per_page');
if ($ppp) {
$query_args['posts_per_page'] = intval($ppp);
}
$display = $config->get('display');
if (!empty($display['terms_ids'])) {
$terms_ids = array_values($display['terms_ids']);
switch ($display['select']) {
case 'only':
$query_args['category__in'] = $terms_ids;
break;
case 'except':
$query_args['category__not_in'] = $terms_ids;
}
}
// get filter request
$request_display = $config->get('request_display');
if ($request_display) {
// get all category terms
$all_terms = get_categories(array('type' => 'post', 'hide_empty' => 1, 'hierarchical' => 0, 'taxonomy' => 'category', 'pad_counts' => false));
// populate $all_terms_array with terms names
$all_terms_array = array();
foreach ($all_terms as $term) {
$all_terms_array[] = $term->term_id;
}
// except for empty term that appers when all filter category selcted, see it's url
if (0 == current($request_display['terms_ids'])) {
$request_display['terms_ids'] = $all_terms_array;
}
// override base tax_query
$query_args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => array_values($request_display['terms_ids']), 'operator' => 'IN'));
if ('except' == $request_display['select']) {
$query_args['tax_query'][0]['operator'] = 'NOT IN';
}
}
$query = new WP_Query($query_args);
return $query;
}
示例14: presscore_body_class
//.........这里部分代码省略.........
}
////////////////////////
// header background //
////////////////////////
if (presscore_mixed_header_with_top_line()) {
$classes[] = 'header-top-line-active';
}
if (presscore_header_with_bg() && (presscore_mixed_header_with_top_line() || !presscore_header_layout_is_side())) {
switch ($config->get('header_background')) {
case 'overlap':
$classes['header_background'] = 'overlap';
break;
case 'transparent':
$classes['header_background'] = 'transparent';
if ('light' === $config->get('header.transparent.color_scheme')) {
$classes[] = 'light-preset-color';
}
break;
}
if ($config->get_bool('header.slideshow.header_below') && 'slideshow' === $config->get('header_title') && in_array($config->get('header_background'), array('transparent', 'normal'))) {
$classes[] = 'floating-navigation-below-slider';
}
}
///////////////////
// header title //
///////////////////
if ('fancy' == $config->get('header_title')) {
$classes[] = 'fancy-header-on';
} elseif ('slideshow' == $config->get('header_title')) {
$classes[] = 'slideshow-on';
if ('3d' == $config->get('slideshow_mode') && 'fullscreen-content' == $config->get('slideshow_3d_layout')) {
$classes[] = 'threed-fullscreen';
}
if (dt_get_paged_var() > 1 && isset($classes['header_background'])) {
unset($classes['header_background']);
}
} elseif (is_single() && 'disabled' == $config->get('header_title')) {
$classes[] = 'title-off';
}
///////////////////
// hover style //
///////////////////
switch ($config->get('template.images.hover.style')) {
case 'grayscale':
$classes[] = 'filter-grayscale-static';
break;
case 'gray_color':
$classes[] = 'filter-grayscale';
break;
case 'blur':
$classes[] = 'image-blur';
break;
case 'scale':
$classes[] = 'scale-on-hover';
break;
}
// default hover icons
switch ($config->get('template.images.hover.icon')) {
case 'none':
$classes[] = 'disabled-hover-icons';
break;
case 'small_corner':
$classes[] = 'small-hover-icons';
break;
case 'big_center':
$classes[] = 'large-hover-icons';
示例15: presscore_list_container_data_atts
/**
* [presscore_list_container_data_atts description]
*
* @since 2.1.0
*
* @return satring [description]
*/
function presscore_list_container_data_atts($custom_atts = array())
{
$data_atts = array('data-cur-page="' . dt_get_paged_var() . '"');
$data_atts = array_merge($data_atts, $custom_atts);
return ' ' . implode(' ', $data_atts);
}