本文整理汇总了PHP中get_the_posts_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_posts_pagination函数的具体用法?PHP get_the_posts_pagination怎么用?PHP get_the_posts_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_posts_pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jbst4_page_navi
function jbst4_page_navi()
{
// Previous/next page navigation.
// replacement for the_posts_pagination
// see: http://wordpress.stackexchange.com/questions/228185/is-using-the-posts-navigation-required
echo str_replace(array('"next page-numbers"', '"previous page-numbers"'), array('"next page-numbers" aria-label="' . __('Next', 'jbst-4') . '"', '"previous page-numbers" aria-label="' . __('Previous', 'jbst-4') . '"'), get_the_posts_pagination(array('prev_text' => '<span aria-hidden="true">«</span><span class="sr-only">' . __('Previous', 'jbst-4') . '</span>', 'next_text' => '<span class="page-link" aria-hidden="true">»</span><span class="sr-only">' . __('Next', 'jbst-4') . '</span>', 'show_all' => true, 'before_page_number' => '<span class="page-link">', 'after_page_number' => '</span>', 'screen_reader_text' => __('Page navigation', 'jbst-4'))));
}
示例2: kt_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since Boutique 1.0
*
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
*/
function kt_paging_nav()
{
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
echo get_the_posts_pagination(array('prev_text' => '<i class="fa fa-long-arrow-left"></i>', 'next_text' => '<i class="fa fa-long-arrow-right"></i>', 'screen_reader_text' => ' ', 'before_page_number' => ''));
}
示例3: sociallyviral_post_navigation
/**
* Display navigation to next/previous post when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function sociallyviral_post_navigation()
{
// Don't print empty markup if there's nowhere to navigate.
// $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
// $next = get_adjacent_post( false, '', false );
// if ( ! $next && ! $previous ) {
// return;
// }
?>
<nav class="navigation posts-navigation" role="navigation">
<!--Start Pagination-->
<?php
$sociallyviral_nav_type = get_theme_mod('sociallyviral_pagination_position');
if (!empty($sociallyviral_nav_type)) {
$sociallyviral_pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Newer', 'sociallyviral'), 'next_text' => __('Older', 'sociallyviral')));
echo $sociallyviral_pagination;
} else {
?>
<h2 class="screen-reader-text"><?php
_e('Posts navigation', 'sociallyviral');
?>
</h2>
<div class="pagination nav-links">
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<i class="demo-icon icon-angle-double-left"></i> Previous', 'sociallyviral'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Next <i class="demo-icon icon-angle-double-right"></i>', 'sociallyviral'));
?>
</div>
<?php
}
?>
</div>
<?php
}
?>
</nav><!--End Pagination-->
<?php
}
示例4: carelib_get_posts_navigation
/**
* Helper function to build a newer/older or paginated navigation element within
* a loop of multiple entries. This takes care of all the annoying formatting
* which usually would need to be done within a template.
*
* @since 1.0.0
* @access public
* @param array $args An optional list of options.
* @return string
*/
function carelib_get_posts_navigation($args = array())
{
global $wp_query;
// Return early if we're on a singular post or we only have one page.
if (is_singular() || 1 === $wp_query->max_num_pages) {
return;
}
$defaults = apply_filters("{$GLOBALS['carelib_prefix']}_posts_navigation_defaults", array('nav_type' => 'pagination', 'prev_link_text' => __('Newer Posts', 'carelib'), 'next_link_text' => __('Older Posts', 'carelib'), 'prev_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Previous Page', 'carelib')), 'next_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Next Page', 'carelib'))));
$args = wp_parse_args($args, $defaults);
if (function_exists('the_posts_pagination') && 'pagination' === $args['nav_type']) {
$output = get_the_posts_pagination($args);
} else {
$output = '<nav ' . carelib_get_attr('nav', 'archive') . '>';
$output .= sprintf('<span class="nav-previous">%s</span>', get_previous_posts_link($args['prev_link_text']));
$output .= sprintf('<span class="nav-next">%s</span>', get_next_posts_link($args['next_link_text']));
$output .= '</nav><!-- .nav-archive -->';
}
return apply_filters("{$GLOBALS['carelib_prefix']}_posts_navigation", $output, $args);
}
示例5: wp_reset_postdata
} else {
?>
<p>Oops! Looks like this on that day you didn't have any posts!... </p>
<?php
}
wp_reset_postdata();
?>
<!--
=== PAGINATION ===
-->
<div id="pagination">
<?php
$pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Back', 'newfangled'), 'next_text' => __('Onward', 'newfangled'), 'screen_reader_text' => __(' ')));
echo $pagination;
?>
</div> <!--div#pagination ends-->
</div>
<div class="col-lg-4">
<?php
get_sidebar('blog');
?>
</div>
</div>
</div>
</section>
<?php
示例6: raindrops_the_pagenation
function raindrops_the_pagenation($html, $position)
{
global $raindrops_document_type;
if (function_exists('get_the_posts_pagination') && $position == 'nav-below') {
if ($raindrops_document_type == 'html5') {
$result = str_replace(array('role="navigation"'), array(''), get_the_posts_pagination());
return $result;
} elseif ($raindrops_document_type == 'xhtml') {
$result = str_replace(array('<nav ', '</nav>'), array('<div ', '</div>'), get_the_posts_pagination());
return $result;
} else {
return $html;
}
}
return $html;
}
示例7: shortcode_registries
public function shortcode_registries()
{
$form_action = get_permalink();
$page = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array('post_type' => array('as-registry'), 'post_status' => array('publish'), 'posts_per_page' => '20', 'order' => 'DESC', 'orderby' => 'date', 'cache_results' => true, 'paged' => $page);
if (isset($_REQUEST['as-group']) && !empty($_REQUEST['as-group'])) {
$group_id = $_REQUEST['as-group'];
$args['tax_query'] = array(array('taxonomy' => 'as-group', 'terms' => $group_id));
}
$group_args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'hierarchical' => true, 'show_count' => 1, 'taxonomy' => 'as-group', 'echo' => 0, 'name' => 'as-group', 'selected' => $group_id, 'show_option_all' => __("Show All", "as-attendance"));
$group_select = wp_dropdown_categories($group_args);
if (isset($_REQUEST['registry_info_date']) && !empty($_REQUEST['registry_info_date'])) {
$date = sanitize_text_field($_REQUEST['registry_info_date']);
$args['meta_query'] = array('date' => array('relation' => 'AND', array('key' => 'registry_info_date', 'value' => $date, 'compare' => '=')));
}
if (isset($_REQUEST['registry_attendee']) && !empty($_REQUEST['registry_attendee'])) {
$person = get_page_by_title($_REQUEST['registry_attendee'], 'OBJECT', 'as-person');
if (!is_null($person)) {
$args['meta_query'] = array('person' => array('relation' => 'AND', array('key' => 'registry_attendee_' . $person->ID)));
}
}
$query = new WP_Query($args);
global $wp_query;
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $query;
$registries = array();
if ($wp_query->have_posts()) {
$pagination = get_the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Back', 'as-attendance'), 'next_text' => __('Onward', 'as-attendance')));
while ($wp_query->have_posts()) {
$wp_query->the_post();
$groups = wp_get_object_terms(get_the_ID(), 'as-group');
if (empty($person)) {
$attendees_ids = get_post_meta(get_the_ID(), 'registry_attendees_ids', true);
if (empty($attendees_ids)) {
echo '0/0';
} else {
$attendees = 0;
foreach ($attendees_ids as $id) {
$attendee = get_post_meta(get_the_ID(), 'registry_attendee_' . $id, true);
if (isset($attendee['present']) && $attendee['present'] == "1") {
$attendees++;
}
}
$percent = $attendees * 100 / count($attendees_ids);
$attendance = $attendees . '/' . count($attendees_ids) . ' (' . number_format($percent, 2) . '%)';
}
$annotation = get_post_meta(get_the_ID(), 'registry_info_annotation', true);
} else {
$attendee_meta = get_post_meta(get_the_ID(), 'registry_attendee_' . $person->ID, true);
$present = $attendee_meta['present'] ? __('Yes', 'at-attendance') : __('No', 'at-attendance');
$annotation = $attendee_meta['annotation'];
}
$registries[] = array('ID' => get_the_ID(), 'title' => get_the_title(), 'groups' => $groups, 'annotation' => $annotation, 'link' => get_the_permalink(), 'attendance' => $attendance, 'present' => $present);
}
}
$wp_query = NULL;
$wp_query = $temp_query;
wp_reset_postdata();
require plugin_dir_path(__FILE__) . '../templates/list-registries.php';
}
示例8: ewf_sc_blog_navigation_default
function ewf_sc_blog_navigation_default()
{
return get_the_posts_pagination();
}
示例9: wp_reset_postdata
}
}
/** End loop divs, varies depending on the type of grid selected **/
if ($i == $num_columns) {
$item_string .= '</div></div><div class="fw-row basic-row">';
$i = 0;
} else {
$item_string .= '</div>';
}
$i++;
}
echo $item_string;
/** Restore original Post Data **/
wp_reset_postdata();
/** Custom query loop pagination **/
$pagination = get_the_posts_pagination(array('mid_size' => 3, 'prev_text' => $prev_text, 'next_text' => $next_text));
$prev_post = get_previous_posts_link();
if (empty($prev_post)) {
$greyed_prev = '<div class="prev page-numbers-faded" >' . $prev_text . '</div>';
} else {
$greyed_prev = '';
}
$next_post = get_next_posts_link();
if (empty($next_post)) {
$greyed_next = '<div class="next page-numbers-faded" >' . $next_text . '</div>';
} else {
$greyed_next = '';
}
/** Reset main query object **/
$wp_query = NULL;
$wp_query = $temp_query;
示例10: everbox_posts_pagination
/**
* Posts pagination
*/
function everbox_posts_pagination()
{
$infinite = get_theme_mod('everbox_infinite', 0);
if ($infinite) {
return;
}
$output = '';
$output .= '<div class="pagination-wrap">';
$output .= get_the_posts_pagination(array('mid_size' => 1, 'screen_reader_text' => ''));
$output .= '</div>';
echo $output;
}
示例11: loop_pagination
/**
* Loop pagination function for paginating loops with multiple posts. This should be used on archive, blog, and
* search pages. It is not for singular views.
*
* @since loop-pagination-0.1.0
* @deprecated 3.0.0
* @access public
* @param array $args
* @return string
*/
function loop_pagination($args = array())
{
_deprecated_function(__FUNCTION__, '3.0.0', 'the_posts_pagination()');
return isset($args['echo']) && false === $args['echo'] ? get_the_posts_pagination($args) : the_posts_pagination($args);
}
示例12: blog_pagination
function blog_pagination()
{
$pagination = get_the_posts_pagination(array('mid_size' => 1, 'prev_text' => __('<span class="fa fa-chevron-left"></span>', 'textdomain'), 'next_text' => __('<span class="fa fa-chevron-right"></span>', 'textdomain'), 'screen_reader_text' => __(' ', 'textdomain')));
echo $pagination;
}
示例13: the_services
/**
* Display or return HTML-formatted services.
*
* @since 1.0.0
* @param string|array $args Arguments.
* @return string
*/
public function the_services($args = '')
{
/**
* Filter the array of default arguments.
*
* @since 1.0.0
* @param array Default arguments.
* @param array The 'the_services' function argument.
*/
$defaults = apply_filters('cherry_the_services_default_args', array('limit' => 3, 'orderby' => 'date', 'order' => 'DESC', 'id' => 0, 'categories' => '', 'show_photo' => true, 'show_name' => true, 'size' => 'thumbnail', 'echo' => true, 'columns' => 3, 'title' => '', 'excerpt_length' => 20, 'wrap_class' => 'cherry-services', 'before_title' => '<h2 class="cherry-services_title">', 'after_title' => '</h2>', 'pager' => false, 'layout' => 'boxed', 'button_text' => __('Read More', 'cherry-services'), 'order_button_text' => __('Order', 'cherry-services'), 'template' => 'default.tmpl', 'item_class' => 'cherry-services_item', 'col_xs' => '12', 'col_sm' => '12', 'col_md' => '12', 'col_lg' => '12', 'container' => '<div class="services-listing">%s</div>'), $args);
$args = wp_parse_args($args, $defaults);
/**
* Filter the array of arguments.
*
* @since 1.0.0
* @param array Arguments.
*/
$args = apply_filters('cherry_the_services_args', $args);
$output = '';
/**
* Fires before the services listing.
*
* @since 1.0.0
* @param array $array The array of arguments.
*/
do_action('cherry_services_before', $args);
// The Query.
$query = $this->get_services($args);
global $wp_query;
$this->temp_query = $wp_query;
$wp_query = null;
$wp_query = $query;
// Fix boolean.
if (isset($args['pager']) && ('true' == $args['pager'] || true === $args['pager'])) {
$args['pager'] = true;
} else {
$args['pager'] = false;
}
// The Display.
if (is_wp_error($query)) {
return;
}
$css_class = '';
if (!empty($args['wrap_class'])) {
$css_class .= esc_attr($args['wrap_class']) . ' ';
}
if (!empty($args['class'])) {
$css_class .= esc_attr($args['class']) . ' ';
}
$css_class .= esc_attr($args['layout']) . '-layout';
// Open wrapper.
$output .= sprintf('<div class="%s">', trim($css_class));
if (!empty($args['title'])) {
$output .= $args['before_title'] . $args['title'] . $args['after_title'];
}
$collapsed = 'pricing-table' == $args['layout'] ? ' collapse-row' : '';
if (false !== $args['columns']) {
$output .= '<div class="row' . $collapsed . '">';
}
if (false !== $args['container']) {
$output .= sprintf($args['container'], $this->get_services_loop($query, $args));
} else {
$output .= $this->get_services_loop($query, $args);
}
if (false !== $args['columns']) {
$output .= '</div>';
}
// Close wrapper.
$output .= '</div>';
if (true == $args['pager']) {
$output .= get_the_posts_pagination();
}
$wp_query = null;
$wp_query = $this->temp_query;
/**
* Filters HTML-formatted services before display or return.
*
* @since 1.0.0
* @param string $output The HTML-formatted services.
* @param array $query List of WP_Post objects.
* @param array $args The array of arguments.
*/
$output = apply_filters('cherry_services_html', $output, $query, $args);
wp_reset_query();
wp_reset_postdata();
if (true !== $args['echo']) {
return $output;
}
// If "echo" is set to true.
echo $output;
/**
* Fires after the services listing.
*
//.........这里部分代码省略.........
示例14: vc_portfolio
//.........这里部分代码省略.........
if (rwmb_meta('us_title_bg_color') != '') {
$anchor_css .= ' background-color: ' . rwmb_meta('us_title_bg_color') . ';';
}
if (rwmb_meta('us_title_text_color') != '') {
$anchor_css .= ' color: ' . rwmb_meta('us_title_text_color') . ';';
}
if ($anchor_css != '') {
$anchor_css = ' style="' . $anchor_css . '"';
}
$output .= '<div class="w-portfolio-item order_' . $portfolio_order_counter . $item_categories_classes . ' animate_reveal">
<div class="w-portfolio-item-h">
<a class="w-portfolio-item-anchor"' . $link_target . $link_ref . ' href="' . $link . '"' . $anchor_css . '>
<div class="w-portfolio-item-image">';
if (has_post_thumbnail()) {
$output .= get_the_post_thumbnail(null, 'portfolio-list-' . $attributes['ratio'], array('class' => 'w-portfolio-item-image-first'));
} else {
$output .= '<img class="w-portfolio-item-image-first" src="' . get_template_directory_uri() . '/img/placeholder/500x500.gif" alt="">';
}
$output .= ' </div>
<div class="w-portfolio-item-meta">
<div class="w-portfolio-item-meta-h">
<h2 class="w-portfolio-item-title">' . the_title('', '', FALSE) . '</h2>
<span class="w-portfolio-item-arrow"></span>
<span class="w-portfolio-item-text">' . $meta_html . '</span>
</div>
</div>
</a>
</div>
</div>';
}
$output .= '</div>';
if ($attributes['pagination'] == 1 or $attributes['pagination'] == 'yes' or $attributes['pagination'] == 'regular') {
$output .= '<div class="w-portfolio-pagination">
' . get_the_posts_pagination(array('prev_text' => '<', 'next_text' => '>', 'before_page_number' => '<span>', 'after_page_number' => '</span>')) . '
</div>';
} elseif ($attributes['pagination'] == 'ajax') {
$max_num_pages = $wp_query->max_num_pages;
if ($max_num_pages > 1) {
$output .= '<div class="w-loadmore" id="us_load_more_' . $rand_id . '">
<a href="javascript:void(0);" id="grid_load_more" class="g-btn color_primary type_flat size_big"><span>' . __('Load More Items', 'us') . '</span></a>
<div class="w-preloader type_2"></div>
</div>';
$output .= '<script type="text/javascript">
var page = 1,
max_page = ' . $max_num_pages . ';
jQuery(document).ready(function(){
jQuery("#us_load_more_' . $rand_id . ' .g-btn").click(function(){
jQuery("#us_load_more_' . $rand_id . '").addClass("loading");
jQuery.ajax({
type: "POST",
url: "' . admin_url("admin-ajax.php") . '",
data: {
action: "portfolioAjaxPagination",
columns: "' . $attributes['columns'] . '",
items: "' . $attributes['items'] . '",
style: "' . $attributes['style'] . '",
align: "' . $attributes['align'] . '",
ratio: "' . $attributes['ratio'] . '",
with_indents: "' . $attributes['with_indents'] . '",
meta: "' . $attributes['meta'] . '",
filters: "' . $attributes['filters'] . '",
category: "' . $attributes['category'] . '",
page: page+1
},
success: function(data, textStatus, XMLHttpRequest){
page++;
示例15: cacsp_pagination
/**
* Template tag to output pagination on archive page.
*
* Pagination resembles the markup from BuddyPress.
*/
function cacsp_pagination($type = 'top')
{
// no pagination? bail!
if ('' === get_the_posts_pagination()) {
return;
}
$pag_args = array('prev_text' => _x('←', 'Pagination previous text', 'social-paper'), 'next_text' => _x('→', 'Pagination next text', 'social-paper'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'social-paper') . ' </span>');
if (defined('DOING_AJAX') && true === DOING_AJAX) {
add_filter('get_pagenum_link', create_function('', "\n\t\t\treturn trailingslashit( get_post_type_archive_link( 'cacsp_paper' ) );\n\t\t"));
$pag_args['format'] = '';
$pag_args['base'] = trailingslashit(get_post_type_archive_link('cacsp_paper')) . 'page/%#%/';
if (!empty($_POST['search_terms'])) {
$pag_args['base'] .= '?s=' . esc_attr($_POST['search_terms']);
}
if (!empty($_POST['scope']) && 'personal' === $_POST['scope'] && is_user_logged_in()) {
if (!empty($_POST['search_terms'])) {
$pag_args['base'] .= '&';
} else {
$pag_args['base'] .= '?';
}
$pag_args['base'] .= 'user=' . bp_loggedin_user_id();
}
}
?>
<div id="pag-<?php
esc_attr_e($type);
?>
" class="pagination no-ajax">
<div class="pag-count">
<?php
if (1 === (int) $GLOBALS['wp_query']->found_posts) {
_e('Viewing 1 paper', 'social-paper');
} else {
$curr_page = get_query_var('paged') ? get_query_var('paged') : 1;
$start_num = intval(($curr_page - 1) * get_query_var('posts_per_page')) + 1;
$to_num = $start_num + (get_query_var('posts_per_page') - 1) > $GLOBALS['wp_query']->found_posts ? $GLOBALS['wp_query']->found_posts : $start_num + (get_query_var('posts_per_page') - 1);
printf(_n('Viewing %1$s - %2$s of %3$s paper', 'Viewing %1$s - %2$s of %3$s papers', (int) $GLOBALS['wp_query']->found_posts, 'social-paper'), number_format_i18n($start_num), number_format_i18n($to_num), number_format_i18n($GLOBALS['wp_query']->found_posts));
}
?>
</div>
<div class="pagination-links">
<?php
echo paginate_links($pag_args);
?>
</div>
</div>
<?php
}