本文整理汇总了PHP中get_previous_posts_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_previous_posts_link函数的具体用法?PHP get_previous_posts_link怎么用?PHP get_previous_posts_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_previous_posts_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:klgrimley,项目名称:mzf,代码行数:31,代码来源:theme-functions.php
示例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
}
开发者ID:alesanchezr,项目名称:personal-blog,代码行数:36,代码来源:template-tags.php
示例3: page_navi
function page_navi($before = '', $after = '')
{
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ($numposts <= $posts_per_page) {
return;
}
if (empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = 3;
$pages_to_show_minus_1 = $pages_to_show - 1;
$half_page_start = floor($pages_to_show_minus_1 / 2);
$half_page_end = ceil($pages_to_show_minus_1 / 2);
$start_page = $paged - $half_page_start;
if ($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if ($end_page - $start_page != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if ($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if ($start_page <= 0) {
$start_page = 1;
}
echo $before . '<div class="pagination_wrapper"><ul class="pagination">' . "";
if ($paged > 1) {
$first_page_text = "First";
echo '<li class="prev"><a href="' . get_pagenum_link() . '" title="First">' . $first_page_text . '</a></li>';
}
$prevposts = get_previous_posts_link('Prev');
if ($prevposts) {
echo '<li>' . $prevposts . '</li>';
} else {
echo '<li class="disabled"><a href="#">Prev</a></li>';
}
for ($i = $start_page; $i <= $end_page; $i++) {
if ($i == $paged) {
echo '<li class="active"><a href="#">' . $i . '</a></li>';
} else {
echo '<li><a href="' . get_pagenum_link($i) . '">' . $i . '</a></li>';
}
}
if ($end_page < $max_page) {
$last_page_text = $max_page;
echo '<li class="next"><a href="' . get_pagenum_link($max_page) . '" title="Last">' . $last_page_text . '</a></li>';
}
echo '<li class="">';
next_posts_link('Next');
echo '</li>';
echo '</ul></div>' . $after . "";
}
开发者ID:madeloa,项目名称:holmesdev,代码行数:60,代码来源:pagination.php
示例4: nice_pagenavi
function nice_pagenavi()
{
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
} else {
?>
<?php
if (get_next_posts_link() || get_previous_posts_link()) {
?>
<nav class="nav-entries">
<?php
next_posts_link('<div class="nav-prev fl">' . __('Older posts', 'nicethemes') . '</div>');
?>
<?php
previous_posts_link('<div class="nav-next fr">' . __('Newer posts', 'nicethemes') . '</div>');
?>
<div class="fix"></div>
</nav>
<?php
}
?>
<?php
}
}
开发者ID:scottbrabazon,项目名称:scottbrabazon.com,代码行数:28,代码来源:functions.php
示例5: orbit_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function orbit_content_nav($nav_id)
{
global $wp_query;
?>
<nav id="<?php
echo $nav_id;
?>
">
<ul>
<?php
if (is_single()) {
// navigation links for single posts
?>
<li><?php
previous_post_link('%link', '' . _x('←', 'Previous post link', 'orbit') . '%title');
?>
</li>
<li><?php
next_post_link('%link', '%title' . _x('→', 'Next post link', 'orbit') . '');
?>
</li>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
// navigation links for home, archive, and search pages
?>
<?php
if (get_next_posts_link()) {
?>
<li><?php
next_posts_link(__('← Older posts', 'orbit'));
?>
</li>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<li><?php
previous_posts_link(__('Newer posts →', 'orbit'));
?>
</li>
<?php
}
?>
<?php
}
?>
</ul>
</nav><!-- #<?php
echo $nav_id;
?>
-->
<?php
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:63,代码来源:required.php
示例6: silencio_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @return void
*/
function silencio_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['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', 'silencio'));
?>
</div>
<?php
}
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'silencio'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
开发者ID:shawncoots,项目名称:ehrlers,代码行数:38,代码来源:template-tags.php
示例7: page_navigation
function page_navigation()
{
$previous_posts_link = get_previous_posts_link('Vorige');
$next_posts_link = get_next_posts_link('Volgende');
if (!$previous_posts_link && !$next_posts_link) {
return;
}
?>
<div class="col-md-9 text-right">
<ul class="pagination">
<?php
if ($previous_posts_link) {
printf('<li>%s</li>', $previous_posts_link);
}
global $wp_query;
$max = $wp_query->max_num_pages;
$current = get_query_var('paged') ? get_query_var('paged') : 1;
printf('<li><a title="Huidige" href="#">%d/%d</a></li>', $current, $max);
?>
<?php
if ($next_posts_link) {
printf('<li>%s</li>', $next_posts_link);
}
?>
</ul>
</div>
<?php
}
开发者ID:G-J,项目名称:WP-Gulp-Bootstrap-FA-Setup,代码行数:28,代码来源:helper.php
示例8: 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;
}
}
}
开发者ID:musashi0128,项目名称:wordpress,代码行数:27,代码来源:seo.php
示例9: 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;
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:32,代码来源:extras.php
示例10: 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));
}
开发者ID:lbngoc,项目名称:Boilerplate-Chester-WordPress-Theme,代码行数:7,代码来源:site_controller.php
示例11: 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
}
开发者ID:Alxmerino,项目名称:am-sandbox-theme,代码行数:34,代码来源:custom-functions.php
示例12: 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
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:26,代码来源:theme-functions.php
示例13: sunspot_content_nav
/**
* Display navigation to next/previous pages when applicable
*
* @since Sunspot 1.0
*/
function sunspot_content_nav( $nav_id ) {
global $wp_query;
$nav_class = 'site-navigation paging-navigation';
if ( is_single() )
$nav_class = 'site-navigation post-navigation';
?>
<nav role="navigation" id="<?php echo $nav_id; ?>" class="<?php echo $nav_class; ?>">
<h1 class="assistive-text"><?php _e( 'Post navigation', 'sunspot' ); ?></h1>
<?php if ( is_single() ) : // navigation links for single posts ?>
<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'sunspot' ) . '</span> %title' ); ?>
<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'sunspot' ) . '</span>' ); ?>
<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>
<?php if ( get_next_posts_link() ) : ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'sunspot' ) ); ?></div>
<?php endif; ?>
<?php if ( get_previous_posts_link() ) : ?>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'sunspot' ) ); ?></div>
<?php endif; ?>
<?php endif; ?>
</nav><!-- #<?php echo $nav_id; ?> -->
<?php
}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:36,代码来源:template-tags.php
示例14: 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
}
开发者ID:unisexx,项目名称:drtooth,代码行数:31,代码来源:template-tags.php
示例15: cinnamon_paging_nav_newer
/**
* Display navigation to newer set of posts when applicable.
*/
function cinnamon_paging_nav_newer()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
?>
<?php
if (get_previous_posts_link()) {
?>
<nav class="navigation paging-navigation newer" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'cinnamon');
?>
</h1>
<div class="nav-links">
<div class="nav-next"><?php
previous_posts_link(__('Newer stories', 'cinnamon'));
?>
</div>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
?>
<?php
}
开发者ID:jeremygeltman,项目名称:ThinkThinly,代码行数:33,代码来源:template-tags.php
示例16: 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;
}
开发者ID:felixarntz,项目名称:wp-starter-theme,代码行数:26,代码来源:BootstrapContentNavigation.php
示例17: 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
}
开发者ID:romainbellande,项目名称:egiis,代码行数:28,代码来源:navigation.php
示例18: 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
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:37,代码来源:template-tags.php
示例19: hitchcock_archive_navigation
function hitchcock_archive_navigation()
{
global $wp_query;
if ($wp_query->max_num_pages > 1) {
?>
<div class="archive-nav">
<?php
if (get_previous_posts_link()) {
previous_posts_link('<span class="fa fw fa-angle-left"></span>');
} else {
echo '<span class="fa fw fa-angle-left"></span>';
}
?>
<span class="sep">/</span>
<?php
if (get_next_posts_link()) {
next_posts_link('<span class="fa fw fa-angle-right"></span>');
} else {
echo '<span class="fa fw fa-angle-right"></span>';
}
?>
<div class="clear"></div>
</div> <!-- /archive-nav-->
<?php
}
}
开发者ID:smichrissoft,项目名称:glonass,代码行数:31,代码来源:functions.php
示例20: 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;
}
开发者ID:peternem,项目名称:vlt-wp,代码行数:28,代码来源:pagination.php
注:本文中的get_previous_posts_link函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论