本文整理汇总了PHP中get_next_posts_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_next_posts_link函数的具体用法?PHP get_next_posts_link怎么用?PHP get_next_posts_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_next_posts_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: woo_pagenav
function woo_pagenav($custom_query = '')
{
global $woo_options, $wp_query, $paged, $page;
// Set query max pages
$max_pages = 1;
if ('' != $custom_query) {
$max_pages = $custom_query->max_num_pages;
} else {
$max_pages = $wp_query->max_num_pages;
}
// If the user has set the option to use simple paging links, display those. By default, display the pagination.
if (@$woo_options['woo_pagination_type'] == 'simple') {
if (get_next_posts_link('', $max_pages) || get_previous_posts_link()) {
?>
<div class="nav-entries">
<?php
next_posts_link('<span class="nav-prev fl"><i class="icon-angle-left"></i> ' . __('Older posts', 'woothemes') . '</span>', $max_pages);
?>
<?php
previous_posts_link('<span class="nav-next fr">' . __('Newer posts', 'woothemes') . ' <i class="icon-angle-right"></i></span>');
?>
<div class="fix"></div>
</div>
<?php
}
// End IF Statement
} else {
woo_pagination(array(), $custom_query);
}
// End IF Statement
}
示例2: cleanblog_posts_navigation
/**
* Display navigation to next/previous set of posts when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function cleanblog_posts_navigation()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<ul class="pager">
<?php
if (get_next_posts_link()) {
?>
<li class="next"><?php
next_posts_link(esc_html__('Older posts', 'cleanblog'));
?>
</li>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<li class="previous"><?php
previous_posts_link(esc_html__('Newer posts', 'cleanblog'));
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例3: showHome
public function showHome()
{
$posts = ChesterWPCoreDataHelpers::getWordpressPostsFromLoop();
$content_block_1 = $this->render('post_previews', array('posts' => $posts, 'next_posts_link' => get_next_posts_link(), 'previous_posts_link' => get_previous_posts_link()));
$latestGallery = $this->render('galleries', array('posts' => ChesterWPCoreDataHelpers::getPosts(false, 'gallery', '1', array('location', 'map', 'website'))));
echo $this->renderPage('grids/grid_two_column', array('content_block_1' => $content_block_1, 'content_block_2' => $latestGallery));
}
示例4: am_paging_nav
function am_paging_nav()
{
global $wp_query;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="nav-links">
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'am_sandbox_theme'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'am_sandbox_theme'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例5: boardwalk_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function boardwalk_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
if (get_next_posts_link()) {
$classes[] = 'next-link';
}
if (get_previous_posts_link()) {
$classes[] = 'previous-link';
}
if (1 == get_theme_mod('boardwalk_filter_featured_images')) {
$classes[] = 'filter-on';
}
if (1 == get_theme_mod('boardwalk_entry_title')) {
$classes[] = 'title-with-content';
}
if (1 == get_theme_mod('boardwalk_unfixed_header')) {
$classes[] = 'unfixed-header';
}
if (is_active_sidebar('sidebar-1') || has_nav_menu('primary')) {
$classes[] = 'has-sidebar';
}
return $classes;
}
示例6: posts_link
public function posts_link($before = '', $after = '', $args = array(), $query = null)
{
global $wp_query;
if (!$query || !is_a($query, 'WP_Query')) {
$query = $wp_query;
}
// Don't print empty markup if there's only one page.
if ($query->max_num_pages < 2) {
return;
}
$args = wp_parse_args($args, array('next_posts_link_label' => null, 'previous_posts_link_label' => null, 'list_class' => '', 'list_item_class' => ''));
$output = '';
$next_posts_link = get_next_posts_link($args['next_posts_link_label'], $query->max_num_pages);
$prev_posts_link = get_previous_posts_link($args['previous_posts_link_label'], $query->max_num_pages);
$list_class = trim($args['list_class']);
$list_item_class = trim($args['list_item_class']);
if ($next_posts_link || $prev_posts_link) {
if (isset($before)) {
$output .= $before;
}
$output .= '<ul' . (!empty($list_class) ? ' class="' . esc_attr($list_class) . '"' : '') . '>';
if ($prev_posts_link) {
$output .= '<li class="prev' . (!empty($list_item_class) ? ' ' . esc_attr($list_item_class) : '') . '">' . $prev_posts_link . '</li>';
}
if ($next_posts_link) {
$output .= '<li class="next' . (!empty($list_item_class) ? ' ' . esc_attr($list_item_class) : '') . '">' . $next_posts_link . '</li>';
}
$output .= '</ul>';
if (isset($after)) {
$output .= $after;
}
}
return $output;
}
示例7: wpex_infinite_scroll
function wpex_infinite_scroll($pages = '', $range = 4)
{
wp_enqueue_script('att-infinitescroll-init', WPEX_JS_DIR . '/infinitescroll-init.js', array('jquery', 'wpex-global'), 1.0, true);
$output = '';
$showitems = $range * 2 + 1;
global $paged;
if (empty($paged)) {
$paged = 1;
}
if ($pages == '') {
global $wp_query;
$pages = $wp_query->max_num_pages;
if (!$pages) {
$pages = 1;
}
}
if (1 != $pages) {
$output .= '<div class="infinite-scroll-nav clr">';
$output .= '<div class="alignleft newer-posts">';
$output .= get_previous_posts_link('← ' . __('Newer Posts', 'wpex'));
$output .= '</div>';
$output .= '<div class="alignright older-posts">';
$output .= get_next_posts_link(__('Older Posts', 'wpex') . ' →');
$output .= '</div>';
$output .= '</div>';
}
echo $output;
}
示例8: sketch_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @return void
*/
function sketch_paging_nav( $max_num_pages = '' ) {
// Get max_num_pages if not provided
if ( '' == $max_num_pages )
$max_num_pages = $GLOBALS['wp_query']->max_num_pages;
// Don't print empty markup if there's only one page.
if ( $max_num_pages < 2 ) {
return;
}
?>
<nav class="navigation paging-navigation clear" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'sketch' ); ?></h1>
<div class="nav-links">
<?php if ( get_next_posts_link( '', $max_num_pages ) ) : ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">Previous</span>', 'sketch' ), $max_num_pages ); ?></div>
<?php endif; ?>
<?php if ( get_previous_posts_link( '', $max_num_pages ) ) : ?>
<div class="nav-next"><?php previous_posts_link( __( '<span class="meta-nav">Next</span>', 'sketch' ), $max_num_pages ); ?></div>
<?php endif; ?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例9: zerif_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function zerif_paging_nav()
{
echo '<div class="clear"></div>';
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'zerif');
?>
</h1>
<div class="nav-links">
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'zerif'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'zerif'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
示例10: rel_next_prevlink_tags
function rel_next_prevlink_tags()
{
//1ページを複数に分けた分割ページ
if (is_single() || is_page()) {
global $wp_query;
$multipage = check_multi_page();
if ($multipage[0] > 1) {
$prev = generate_multipage_url('prev');
$next = generate_multipage_url('next');
if ($prev) {
echo '<link rel="prev" href="' . $prev . '" />' . PHP_EOL;
}
if ($next) {
echo '<link rel="next" href="' . $next . '" />' . PHP_EOL;
}
}
} else {
//トップページやカテゴリページなどの分割ページの設定
global $paged;
if (get_previous_posts_link()) {
echo '<link rel="prev" href="' . get_pagenum_link($paged - 1) . '" />' . PHP_EOL;
}
if (get_next_posts_link()) {
echo '<link rel="next" href="' . get_pagenum_link($paged + 1) . '" />' . PHP_EOL;
}
}
}
示例11: cinnamon_paging_nav_older
/**
* Display navigation to older set of posts when applicable.
*/
function cinnamon_paging_nav_older()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<?php
if (get_next_posts_link()) {
?>
<nav class="navigation paging-navigation older" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'cinnamon');
?>
</h1>
<div class="nav-links">
<div class="nav-previous"><?php
next_posts_link(__('More stories', 'cinnamon'));
?>
</div>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
?>
<?php
}
示例12: post_navigation
function post_navigation()
{
echo '<div class="navigation">';
echo ' <div class="next-posts">' . get_next_posts_link('« Older Entries') . '</div>';
echo ' <div class="prev-posts">' . get_previous_posts_link('Newer Entries »') . '</div>';
echo '</div>';
}
示例13: get_the_posts_navigation
public static function get_the_posts_navigation($args = array())
{
$navigation = '';
if ($GLOBALS['wp_query']->max_num_pages > 1) {
$args = wp_parse_args($args, array('prev_text' => __('Older posts', 'wp-starter-theme'), 'next_text' => __('Newer posts', 'wp-starter-theme'), 'screen_reader_text' => __('Posts navigation', 'wp-starter-theme'), 'aligned' => false));
$prev_class = '';
$next_class = '';
if ($args['aligned']) {
$prev_class = ' class="pager-prev"';
$next_class = ' class="pager-next"';
}
$next_link = get_previous_posts_link($args['next_text']);
$prev_link = get_next_posts_link($args['prev_text']);
if ($prev_link || $next_link) {
if ($prev_link) {
$navigation .= '<li' . $prev_class . '>' . $prev_link . '</li>';
}
if ($next_link) {
$navigation .= '<li' . $next_class . '>' . $next_link . '</li>';
}
$navigation = '<ul class="pager">' . $navigation . '</ul>';
$navigation = _navigation_markup($navigation, 'posts-navigation', $args['screen_reader_text']);
}
}
return $navigation;
}
示例14: woo_pagenav
function woo_pagenav()
{
global $woo_options;
// If the user has set the option to use simple paging links, display those. By default, display the pagination.
if (array_key_exists('woo_pagination_type', $woo_options) && $woo_options['woo_pagination_type'] == 'simple') {
if (get_next_posts_link() || get_previous_posts_link()) {
?>
<div class="nav-entries">
<?php
next_posts_link('<span class="nav-prev fl">' . __('<span class="meta-nav">←</span> Older posts', 'woothemes') . '</span>');
?>
<?php
previous_posts_link('<span class="nav-next fr">' . __('Newer posts <span class="meta-nav">→</span>', 'woothemes') . '</span>');
?>
<div class="fix"></div>
</div>
<?php
}
// ENDIF
} else {
woo_pagination();
}
// ENDIF
}
示例15: voidx_post_navigation
function voidx_post_navigation()
{
?>
<nav class="nav-posts" role="navigation">
<div class="nav-links">
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-previous prev-page">
<?php
previous_posts_link(__('<span class="nav-arrow">← </span>Previous', 'voidx'));
?>
</div>
<?php
}
if (get_next_posts_link()) {
?>
<div class="nav-next next-page">
<?php
next_posts_link(__('Next<span class="nav-arrow"> →</span>', 'voidx'));
?>
</div>
<?php
}
?>
</div>
</nav><?php
}