本文整理汇总了PHP中get_next_posts_page_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_next_posts_page_link函数的具体用法?PHP get_next_posts_page_link怎么用?PHP get_next_posts_page_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_next_posts_page_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: link_rel_prev_next
function link_rel_prev_next()
{
// <link rel="home" title="Home" href="http://url/of/home/page" />
$prev_url = '';
$next_url = '';
if (!is_singular()) {
$prev_url = get_previous_posts_page_link();
$next_url = get_next_posts_page_link();
if (!empty($prev_url)) {
printf('<link rel="prev" href="%s" />' . "\n", $prev_url);
}
if (!empty($next_url)) {
printf('<link rel="next" href="%s" />' . "\n", $next_url);
}
} else {
global $post;
// $up_post = get_post($post->post_parent);
//
// $prev_post = get_previous_post();
// if ( !empty( $prev_post->ID))
// printf( '<link rel="prev" title="%s" href="%s" />' . "\n", $prev_post->post_title , get_permalink($prev_post->ID) );
//
// $next_post = get_next_post();
// if ( !empty($next_post->ID))
// printf( '<link rel="next" title="%s" href="%s" />' . "\n", $prev_post->post_title , get_permalink($next_post->ID) );
safe_link_rel('next', get_post($post->parent));
safe_link_rel('prev', get_previous_post());
safe_link_rel('next', get_next_post());
}
}
示例2: cosmos_prefetch_prerender
function cosmos_prefetch_prerender()
{
global $wp_query, $paged;
if ((is_home() || is_archive() || is_category() || is_tax() || is_tag()) && $paged < $wp_query->max_num_pages) {
echo "<link rel=\"prefetch\" href=\"" . get_next_posts_page_link() . "\" />\n";
echo "<link rel=\"prerender\" href=\"" . get_next_posts_page_link() . "\" />\n";
}
}
示例3: pagination_links
function pagination_links()
{
global $wp_query;
if ($wp_query->max_num_pages <= 1) {
return;
}
ob_start();
?>
<nav class="nav pagination cf">
<?php
$args = array('show_all' => true);
echo paginate_links($args);
?>
</nav>
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
if ($paged < $wp_query->max_num_pages) {
?>
<div class="content_module content_module--button">
<a href="<?php
echo get_next_posts_page_link();
?>
?test=ja" class="button--big load-more-posts">
<span class="label">Load More</span>
<span class="loading-animation">
<span class="loading-element"></span>
</span>
</a>
</div>
<?php
}
?>
<?php
echo ob_get_clean();
}
示例4: malinky_ajax_pagination_scripts
/**
* Enqueue scripts.
*/
public function malinky_ajax_pagination_scripts()
{
// Conditional load, don't include script on singles.
if (malinky_is_blog_page(false)) {
wp_register_script('malinky-ajax-pagination-main-js', MALINKY_AJAX_PAGINATION_PLUGIN_URL . '/js/main.js', array('jquery'), NULL, true);
global $wp_query;
// Saved settings.
for ($x = 1; $x <= $this->settings->malinky_ajax_pagination_settings_count_settings(); $x++) {
$malinky_settings[$x] = get_option('_malinky_ajax_pagination_settings_' . $x);
}
// Set ajax loader images.
foreach ($malinky_settings as $key => $setting) {
$malinky_settings[$key]['ajax_loader'] = malinky_ajax_pagination_ajax_loader($malinky_settings[$key]['ajax_loader']);
}
// Settings from the loaded page.
$malinky_settings['max_num_pages'] = $wp_query->max_num_pages;
$malinky_settings['next_page_number'] = get_query_var('paged') > 1 ? get_query_var('paged') + 1 : 1 + 1;
$malinky_settings['next_page_url'] = get_next_posts_page_link();
wp_localize_script('malinky-ajax-pagination-main-js', 'malinkySettings', $malinky_settings);
wp_enqueue_script('malinky-ajax-pagination-main-js');
}
}
示例5: get_next_posts_page_link
</div>
</li>
<?php
$i++;
}
?>
</ul>
<?php
}
if ($page < $pquery->max_num_pages) {
?>
<div class="pag">
<a href="<?php
echo get_next_posts_page_link();
?>
" class="load-more">Load More <span class="theme-arrow-head-down"></span></a>
</div>
<?php
}
wp_reset_postdata();
?>
<!--<a class="load-more" href="#">load more <span class="theme-arrow-head-down"></span></a>-->
</div>
</article>
</div>
</div>
</div>
示例6: cupid_paging_infinitescroll
function cupid_paging_infinitescroll()
{
global $wp_query;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
$link = get_next_posts_page_link($wp_query->max_num_pages);
if (!empty($link)) {
?>
<nav id="infinite_scroll_button">
<a href="<?php
echo esc_url($link);
?>
"></a>
</nav>
<div id="infinite_scroll_loading" class="text-center infinite-scroll-loading"></div>
<?php
}
}
示例7: get_pagination
/**
* Get pagination.
*
* @param array $prefs
* @return array mixed
*/
public static function get_pagination($prefs = array())
{
global $wp_query;
global $paged;
global $wp_rewrite;
$args = array();
$args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']);
if ($wp_rewrite->using_permalinks()) {
$url = explode('?', get_pagenum_link(0));
if (isset($url[1])) {
parse_str($url[1], $query);
$args['add_args'] = $query;
}
$args['format'] = 'page/%#%';
$args['base'] = trailingslashit($url[0]) . '%_%';
} else {
$big = 999999999;
$args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big)));
}
$args['type'] = 'array';
$args['current'] = max(1, get_query_var('paged'));
$args['mid_size'] = max(9 - $args['current'], 3);
$args['prev_next'] = false;
if (is_int($prefs)) {
$args['mid_size'] = $prefs - 2;
} else {
$args = array_merge($args, $prefs);
}
$data = array();
$data['current'] = $args['current'];
$data['total'] = $args['total'];
$data['pages'] = TimberHelper::paginate_links($args);
$next = get_next_posts_page_link($args['total']);
if ($next) {
$data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next');
}
$prev = previous_posts(false);
if ($prev) {
$data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev');
}
if ($paged < 2) {
$data['prev'] = '';
}
return $data;
}
示例8: next_posts
/**
* Display or return the next posts pages link.
*
* @since 0.71
*
* @param int $max_page Optional. Max pages.
* @param boolean $echo Optional. Echo or return;
*/
function next_posts( $max_page = 0, $echo = true ) {
$output = clean_url( get_next_posts_page_link( $max_page ) );
if ( $echo )
echo $output;
else
return $output;
}
示例9: genesis_paged_rel
/**
* Output rel links in the head to indicate previous and next pages in paginated archives and posts.
*
* @link http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
*
* @since 2.2.0
*/
function genesis_paged_rel()
{
global $wp_query;
$prev = $next = '';
$paged = intval(get_query_var('paged'));
$page = intval(get_query_var('page'));
if (!is_singular()) {
$prev = $paged > 1 ? get_previous_posts_page_link() : $prev;
$next = $paged < $wp_query->max_num_pages ? get_next_posts_page_link($wp_query->max_num_pages) : $next;
} else {
//* No need for this on previews
if (is_preview()) {
return '';
}
$numpages = substr_count($wp_query->post->post_content, '<!--nextpage-->') + 1;
if ($numpages && !$page) {
$page = 1;
}
if ($page > 1) {
$prev = genesis_paged_post_url($page - 1);
}
if ($page < $numpages) {
$next = genesis_paged_post_url($page + 1);
}
}
if ($prev) {
printf('<link rel="prev" href="%s" />' . "\n", esc_url($prev));
}
if ($next) {
printf('<link rel="next" href="%s" />' . "\n", esc_url($next));
}
}
示例10: Bing_mobile_page_navi
/**
*移动版分页导航
*http://www.bgbk.org
*/
function Bing_mobile_page_navi()
{
$next_link = get_next_posts_page_link($GLOBALS['wp_query']->max_num_pages);
?>
<div class="span12 posts-list-mobile-page-navi" data-next-link="<?php
echo esc_url($next_link);
?>
">
<div class="panel">
<?php
if (empty($next_link)) {
?>
<p class="help-text"><?php
_e('全部加载完成', 'Bing');
?>
</p>
<?php
} else {
?>
<p class="help-text"><?php
_e('更多...', 'Bing');
?>
</p>
<p class="loading">
<span class="dashicons dashicons-image-rotate"></span>
<?php
_e('加载中...', 'Bing');
?>
</p>
<?php
}
?>
</div>
</div>
<?php
}
示例11: numeric_posts_nav
/**
* Print numeric pagination
*/
function numeric_posts_nav($custom_query = null)
{
if (is_singular() && $custom_query === null) {
return;
}
global $wp_query;
if ($custom_query) {
$wp_query = $custom_query !== null ? $custom_query : $wp_query;
}
/** Stop execution if there's only 1 page */
if ($wp_query->max_num_pages <= 1) {
return;
}
$paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
$max = intval($wp_query->max_num_pages);
/** Add current page to the array */
if ($paged >= 1) {
$links[] = $paged;
}
/** Add the pages around the current page to the array */
if ($paged >= 3) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ($paged + 2 <= $max) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '<div class="numbered-pagination"><ul class="unstyled inline">' . "\n";
/** Previous Post Link */
if (get_previous_posts_link()) {
printf('<li><a href="%s" class="prev">%s</a></li>' . "\n", get_previous_posts_page_link(), print_image('arrow_blue.svg'));
}
/** Link to first page, plus ellipses if necessary */
if (!in_array(1, $links)) {
$class = 1 == $paged ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link(1)), '1');
if (!in_array(2, $links)) {
echo '<li>…</li>';
}
}
/** Link to current page, plus 2 pages in either direction if necessary */
sort($links);
foreach ((array) $links as $link) {
$class = $paged == $link ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)), $link);
}
/** Link to last page, plus ellipses if necessary */
if (!in_array($max, $links)) {
if (!in_array($max - 1, $links)) {
echo '<li>…</li>' . "\n";
}
$class = $paged == $max ? ' class="active"' : '';
printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($max)), $max);
}
/** Next Post Link */
if (get_next_posts_link()) {
printf('<li><a href="%s" class="next">%s</a></li>' . "\n", get_next_posts_page_link(), print_image('arrow_blue.svg'));
}
echo '</ul></div>' . "\n";
}
示例12: next_posts_link
function next_posts_link($label = 'Next Page »', $max_page = 0)
{
global $paged, $wp_query;
$link = '';
if (!$max_page) {
$max_page = $wp_query->max_num_pages;
}
if (!$paged) {
$paged = 1;
}
$nextpage = intval($paged) + 1;
if (!is_single() && (empty($paged) || $nextpage <= $max_page)) {
$link .= '<a href="';
$link .= clean_url(get_next_posts_page_link($max_page));
$link .= '">' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) . '</a>';
}
return $link;
}
示例13: ks_next_posts_link
function ks_next_posts_link()
{
if (is_single()) {
return;
}
$defaults = array('anchor' => __('#.Next', 'ktai_style') . '<img localsrc="8" alt=" »">', 'accesskey' => '#', 'max_pages' => 0, 'echo' => true);
$r = _ks_parse_arg(func_get_args(), $defaults);
if (isset($r['label'])) {
$r['anchor'] = $r['label'];
}
if (!$r['max_pages']) {
$r['max_pages'] = _ks_get_max_num_pages();
}
$paged = intval(get_query_var('paged'));
$nextpage = intval($paged) + 1;
$output = '';
if (empty($paged) || $nextpage <= $r['max_pages']) {
$output = '<a href="' . KtaiStyle::strip_host(clean_url(_ks_quoted_remove_query_arg('kp', get_next_posts_page_link($r['max_pages'])))) . '"' . ks_accesskey_html($r['accesskey']) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $r['anchor']) . '</a>';
}
if ($r['echo']) {
echo $output;
}
return $output;
}
示例14: next_posts
function next_posts($max_page = 0)
{
echo clean_url(get_next_posts_page_link($max_page));
}
示例15: get_next_posts_page_link
<div class="panel panel--subtle">
<nav class="pagination nav nav--pagination">
<?php
// Navigation links.
if (get_next_posts_link()) {
echo '<a rel="next" href="' . get_next_posts_page_link() . '" class="btn next ss-navigateright">Next</a>';
}
if (get_previous_posts_link()) {
echo '<a rel="previous" href="' . get_previous_posts_page_link() . '" class="btn prev ss-navigateleft">Previous</a>';
}
// Number of pages.
echo 'Page ' . ($wp_query->query_vars['paged'] ?: 1) . ' of ' . $wp_query->max_num_pages;
?>
</nav>
</div><!--/.panel -->