本文整理汇总了PHP中dt_paginator函数的典型用法代码示例。如果您正苦于以下问题:PHP dt_paginator函数的具体用法?PHP dt_paginator怎么用?PHP dt_paginator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_paginator函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presscore_blog_ajax_loading_responce
function presscore_blog_ajax_loading_responce($ajax_data = array())
{
global $post, $wp_query, $paged, $page;
extract($ajax_data);
if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
$responce = array('success' => false, 'reason' => 'corrupted data');
} else {
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
require_once PRESSCORE_DIR . '/template-hooks.php';
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
$html = '';
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = Presscore_Config::get_instance();
$config->set('template', 'blog');
$config->set('layout', empty($page_data['layout']) ? 'masonry' : $page_data['layout']);
presscore_config_base_init();
presscore_react_on_categorizer();
do_action('presscore_before_loop');
ob_start();
$query = presscore_get_blog_query();
if ($query->have_posts()) {
$page_layout = presscore_get_current_layout_type();
$current_post = $posts_count;
while ($query->have_posts()) {
$query->the_post();
/*
// check if current post already loaded
$key_in_loaded = array_search( $post->ID, $loaded_items );
if ( false !== $key_in_loaded ) {
unset( $loaded_items[ $key_in_loaded ] );
continue;
}
*/
presscore_populate_post_config();
switch ($page_layout) {
case 'masonry':
presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post');
break;
case 'list':
// global posts counter
$config->set('post.query.var.current_post', ++$current_post);
presscore_get_template_part('theme', 'blog/list/blog-list-post');
break;
}
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$responce = array('success' => true);
///////////////////
// pagination //
///////////////////
$next_page_link = dt_get_next_posts_url($query->max_num_pages);
if ($next_page_link) {
$responce['nextPage'] = dt_get_paged_var() + 1;
} else {
$responce['nextPage'] = 0;
}
$load_style = $config->get('load_style');
// pagination 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) {
$responce['currentPage'] = dt_get_paged_var();
$responce['paginationHtml'] = $pagination;
} else {
$responce['currentPage'] = $post_paged;
}
$responce['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) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
/////////////////
// response //
/////////////////
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
$responce['order'] = $query->query['order'];
$responce['orderby'] = $query->query['orderby'];
}
// main loop
$responce['html'] = $html;
}
return $responce;
}
示例2: 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
示例3: woocommerce_pagination
/**
* Output the pagination.
* (override)
*
* @access public
* @subpackage Loop
* @return void
*/
function woocommerce_pagination()
{
global $wp_query;
if ($wp_query->max_num_pages <= 1) {
return;
}
dt_paginator($wp_query, array('class' => 'woocommerce-pagination paginator'));
}
示例4: the_loop
protected function the_loop($args = array())
{
$default_args = array('masonry_container_class' => array('wf-container'), 'masonry_container_data' => array(), 'post_template_callback' => null, 'query' => null, 'post_type' => $this->post_type, 'taxonomy' => $this->taxonomy, 'select' => 'all', 'show_filter' => false, 'full_width' => false, 'posts_per_page' => '-1');
$args = wp_parse_args($args, $default_args);
if (!isset($args['query'], $args['post_template_callback']) || !is_callable($args['post_template_callback'])) {
return '';
}
ob_start();
do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
// main wrap
echo '<div class="dt-shortcode with-isotope">';
// posts filter
$this->display_posts_filter(array('post_type' => $this->post_type, 'taxonomy' => $this->taxonomy, 'query' => $args['query'], 'select' => $args['select'], 'show_category_filter' => $args['show_filter']));
// fullwidth wrap open
if ($args['full_width']) {
echo '<div class="full-width-wrap">';
}
$container_data = array('data-posts-per-page="' . $args['posts_per_page'] . '"');
$container_data = empty($args['masonry_container_data']) ? $container_data : array_merge($container_data, (array) $args['masonry_container_data']);
// masonry container open
echo '<div ' . presscore_masonry_container_class($args['masonry_container_class']) . presscore_masonry_container_data_atts($container_data) . '>';
while ($args['query']->have_posts()) {
$args['query']->the_post();
call_user_func($args['post_template_callback']);
}
// masonry container close
echo '</div>';
// fullwidth wrap close
if ($args['full_width']) {
echo '</div>';
}
// pagination
if ($args['posts_per_page'] > 0) {
dt_paginator($args['query'], array('class' => 'paginator iso-paginator', 'max_num_pages' => intval(ceil(count($args['query']->posts) / $args['posts_per_page'])), 'posts_per_page' => $args['posts_per_page'], 'paged' => 1));
}
// main wrap
echo '</div>';
do_action('presscore_after_shortcode_loop', $this->shortcode_name, $this->atts);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例5: get_media_masonry_content
/**
* Get media posts in masonry layout.
*
*/
public static function get_media_masonry_content($ajax_data = array())
{
global $post, $wp_query, $paged, $page;
extract($ajax_data);
if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
$responce = array('success' => false, 'reason' => 'corrupted data');
} else {
/**
* Include AQResizer.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
/**
* Include helpers.
*
*/
require_once PRESSCORE_DIR . '/helpers.php';
/**
* Include template actions and filters.
*
*/
require_once PRESSCORE_DIR . '/template-tags.php';
/**
* Include paginator.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
if (!class_exists('Mobile_Detect')) {
/**
* Mobile detection library.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php';
}
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
$config = Presscore_Config::get_instance();
$config->set('template', 'media');
$config->base_init($post_id);
if ($config->get('justified_grid') && isset($sender) && in_array($sender, array('filter', 'paginator'))) {
$loaded_items = array();
}
$html = '';
$responce = array('success' => true);
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
ob_start();
// presscore_post_meta_new_gallery_controller();
do_action('presscore_before_loop');
$page_query = Presscore_Inc_Albums_Post_Type::get_media_template_query();
if ($page_query->have_posts()) {
while ($page_query->have_posts()) {
$page_query->the_post();
$key_in_loaded = array_search($post->ID, $loaded_items);
if (false !== $key_in_loaded) {
unset($loaded_items[$key_in_loaded]);
continue;
}
get_template_part('content', 'media');
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$next_page_link = dt_get_next_posts_url($page_query->max_num_pages);
if ($next_page_link) {
$responce['nextPage'] = dt_get_paged_var() + 1;
} else {
$responce['nextPage'] = 0;
}
$load_style = $config->get('load_style');
// pagination style
if (presscore_is_load_more_pagination()) {
$pagination = dt_get_next_page_button($page_query->max_num_pages, 'paginator paginator-more-button with-ajax');
if ($pagination) {
$responce['currentPage'] = dt_get_paged_var();
$responce['paginationHtml'] = $pagination;
} else {
$responce['currentPage'] = $post_paged;
}
$responce['paginationType'] = 'more';
} else {
if ('ajax_pagination' == $load_style) {
ob_start();
dt_paginator($page_query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
$pagination = ob_get_clean();
if ($pagination) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
//.........这里部分代码省略.........
示例6: presscore_populate_team_config
$page_query->the_post();
// populate config
presscore_populate_team_config();
dt_get_template_part('team/team-post');
}
wp_reset_postdata();
}
// masonry container close
echo '</div>';
// fullwidth wrap close
if ($config->get('full_width')) {
echo '</div>';
}
/////////////////////
// Pagination //
/////////////////////
dt_paginator($page_query);
}
do_action('presscore_after_loop');
}
}
// main loop
?>
</div><!-- #content -->
<?php
do_action('presscore_after_content');
}
// if content visible
get_footer();
示例7: presscore_testimonials_ajax_loading_responce
function presscore_testimonials_ajax_loading_responce($ajax_data = array())
{
global $post, $wp_query, $paged, $page;
extract($ajax_data);
if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
$responce = array('success' => false, 'reason' => 'corrupted data');
} else {
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
require_once PRESSCORE_DIR . '/template-hooks.php';
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = presscore_get_config();
$config->set('template', 'testimonials');
$config->set('template.layout.type', 'masonry');
presscore_config_base_init();
do_action('presscore_before_loop');
$query = Presscore_Inc_Testimonials_Post_Type::get_template_query();
$html = '';
ob_start();
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
/*
// check if current post already loaded
$key_in_loaded = array_search( $post->ID, $loaded_items );
if ( false !== $key_in_loaded ) {
unset( $loaded_items[ $key_in_loaded ] );
continue;
}
*/
// post template
get_template_part('content', 'testimonials');
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$responce = array('success' => true);
///////////////////
// pagination //
///////////////////
$next_page_link = dt_get_next_posts_url($query->max_num_pages);
if ($next_page_link) {
$responce['nextPage'] = dt_get_paged_var() + 1;
} else {
$responce['nextPage'] = 0;
}
$load_style = $config->get('load_style');
// pagination 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) {
$responce['currentPage'] = dt_get_paged_var();
$responce['paginationHtml'] = $pagination;
} else {
$responce['currentPage'] = $post_paged;
}
$responce['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) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
/////////////////
// response //
/////////////////
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
$responce['order'] = $query->get('order', '');
$responce['orderby'] = $query->get('orderby', 'date');
}
// main loop
$responce['html'] = $html;
}
return $responce;
}
示例8: do_action
<div id="content" class="content" role="main">
<?php
if (have_posts()) {
do_action('presscore_before_loop');
// backup config
$config_backup = $config->get();
// masonry container open
echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>';
while (have_posts()) {
the_post();
presscore_archive_post_content();
$config->reset($config_backup);
}
// masonry container close
echo '</div>';
dt_paginator();
do_action('presscore_after_loop');
} else {
get_template_part('no-results', 'search');
}
?>
</div><!-- #content -->
<?php
do_action('presscore_after_content');
?>
<?php
get_footer();
示例9: dt_get_next_page_button
?>
<?php
if (presscore_is_load_more_pagination()) {
?>
<?php
echo dt_get_next_page_button($page_query->max_num_pages, 'paginator paginator-more-button with-ajax');
?>
<?php
} else {
?>
<?php
dt_paginator($page_query, array('class' => 'paginator' . $ajax_class));
?>
<?php
}
?>
<?php
} else {
?>
<?php
the_content();
?>
<?php
示例10: presscore_complex_pagination
function presscore_complex_pagination(&$query)
{
if ($query) {
if (presscore_is_load_more_pagination()) {
// load more button
echo dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
} else {
$ajax_class = 'default' != presscore_get_config()->get('load_style') ? ' with-ajax' : '';
// paginator
dt_paginator($query, array('class' => 'paginator' . $ajax_class));
}
}
}
示例11: dt_paginator
?>
</div>
<?php
if ($full_width) {
?>
</div>
<?php
}
?>
<?php
dt_paginator($blog_query);
?>
<?php
do_action('presscore_after_loop');
?>
<?php
}
?>
<?php
}
?>
</div><!-- #content -->
示例12: presscore_blog_ajax_loading_responce
function presscore_blog_ajax_loading_responce($ajax_data = array())
{
global $post, $wp_query, $paged, $page;
extract($ajax_data);
if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
$responce = array('success' => false, 'reason' => 'corrupted data');
} else {
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
require_once PRESSCORE_DIR . '/template-hooks.php';
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = Presscore_Config::get_instance();
$config->set('template', 'blog');
$config->set('template.layout.type', 'masonry');
presscore_config_base_init();
presscore_post_meta_new_controller();
do_action('presscore_before_loop');
$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;
}
}
$query = new WP_Query($query_args);
$html = '';
ob_start();
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
// check if current post already loaded
$key_in_loaded = array_search($post->ID, $loaded_items);
if (false !== $key_in_loaded) {
unset($loaded_items[$key_in_loaded]);
continue;
}
presscore_populate_post_config();
// post template
dt_get_template_part('blog/masonry/blog-masonry-post');
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$responce = array('success' => true);
///////////////////
// pagination //
///////////////////
$next_page_link = dt_get_next_posts_url($query->max_num_pages);
if ($next_page_link) {
$responce['nextPage'] = dt_get_paged_var() + 1;
} else {
$responce['nextPage'] = 0;
}
$load_style = $config->get('load_style');
// pagination 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) {
$responce['currentPage'] = dt_get_paged_var();
$responce['paginationHtml'] = $pagination;
} else {
$responce['currentPage'] = $post_paged;
}
$responce['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) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
/////////////////
// response //
/////////////////
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
$responce['order'] = $query->query['order'];
$responce['orderby'] = $query->query['orderby'];
}
// main loop
//.........这里部分代码省略.........