本文整理汇总了PHP中loop_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP loop_pagination函数的具体用法?PHP loop_pagination怎么用?PHP loop_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loop_pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: omega_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function omega_content_nav()
{
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if (is_single()) {
$previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if (!$next && !$previous) {
return;
}
}
if (is_singular() && !get_theme_mod('single_nav', 0)) {
return;
}
// Don't print empty markup in archives if there's only one page.
if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
return;
}
$nav_class = is_single() ? 'post-navigation' : 'paging-navigation';
?>
<nav role="navigation" id="nav-below" class="navigation <?php
echo $nav_class;
?>
">
<?php
if (is_single() && get_theme_mod('single_nav', 0)) {
// navigation links for single posts
?>
<?php
previous_post_link('<div class="nav-previous alignleft">%link</div>', '<span class="meta-nav">' . _x('←', 'Previous post link', 'omega') . '</span> %title');
?>
<?php
next_post_link('<div class="nav-next alignright">%link</div>', '%title <span class="meta-nav">' . _x('→', 'Next post link', 'omega') . '</span>');
?>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
// navigation links for home, archive, and search pages
?>
<?php
loop_pagination();
?>
<?php
}
?>
</nav><!-- #nav-below -->
<?php
}
示例2: elseif
<?php
} elseif (is_singular('post')) {
?>
<div class="loop-nav">
<?php
previous_post_link('%link', '<span class="previous">' . __('<span class="meta-nav">←</span> Previous', hybrid_get_textdomain()) . '</span>');
?>
<?php
next_post_link('%link', '<span class="next">' . __('Next <span class="meta-nav">→</span>', hybrid_get_textdomain()) . '</span>');
?>
</div><!-- .loop-nav -->
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('prev_text' => __('<span class="meta-nav">←</span> Previous', hybrid_get_textdomain()), 'next_text' => __('Next <span class="meta-nav">→</span>', hybrid_get_textdomain())));
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('<span class="meta-nav">←</span> Previous', hybrid_get_textdomain()) . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', hybrid_get_textdomain()) . '</span>')))) {
?>
<div class="loop-nav">
<?php
echo $nav;
?>
</div><!-- .loop-nav -->
<?php
}
示例3: tamatebako_archive_footer
/**
* Archive Footer (Pagination)
*
* @since 0.1.0
*/
function tamatebako_archive_footer()
{
?>
<?php
if (is_home() || is_archive() || is_search()) {
?>
<?php
loop_pagination(array('prev_text' => '<span class="screen-reader-text">' . tamatebako_string('previous') . '</span>', 'next_text' => '<span class="screen-reader-text">' . tamatebako_string('next') . '</span>', 'end_size' => 3, 'mid_size' => 3));
?>
<?php
}
?>
<?php
}
示例4: elseif
<?php
} elseif (is_singular('post')) {
?>
<div class="loop-nav">
<?php
previous_post_link('%link', '<span class="previous">' . __('<span class="meta-nav">←</span> Previous', 'bearded') . '</span>');
?>
<?php
next_post_link('%link', '<span class="next">' . __('Next <span class="meta-nav">→</span>', 'bearded') . '</span>');
?>
</div><!-- .loop-nav -->
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('prev_text' => __('Previous', 'bearded'), 'next_text' => __('Next', 'bearded')));
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('Previous', 'bearded') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next', 'bearded') . '</span>')))) {
?>
<div class="loop-nav">
<?php
echo $nav;
?>
</div><!-- .loop-nav -->
<?php
}
示例5: previous_post_link
<?php previous_post_link( '<div class="previous"><span>' . __( 'Previous Post ', hybrid_get_parent_textdomain() ) . '</span>' . __('%link', hybrid_get_parent_textdomain()) . '</div>', '%title' ); ?>
<?php /*
<div class="previous">
<?php previous_post_link( '<span>' . __('%link', hybrid_get_parent_textdomain() ) . '</span>','Previous Post'); ?>
<?php previous_post_link( '%link','%title'); ?>
</div>
*/ ?>
<?php next_post_link( '<div class="next"><span>' . __( 'Next Post ', hybrid_get_parent_textdomain() ) . '</span>' . __('%link', hybrid_get_parent_textdomain()) . '</div>', '%title' ); ?>
<?php /*
<div class="next">
<?php next_post_link( '<span>' . __('%link', hybrid_get_parent_textdomain() ) . '</span>','Next Post'); ?>
<?php next_post_link( '%link','%title'); ?>
</div>
*/ ?>
<div class="clear"></div>
</div><!-- .loop-nav -->
<?php elseif ( !is_singular() && current_theme_supports( 'loop-pagination' ) ) : loop_pagination(); ?>
<?php elseif ( !is_singular() && $nav = get_posts_nav_link( array( 'sep' => '', 'prelabel' => '<span class="previous">' . __( '← Previous', hybrid_get_parent_textdomain() ) . '</span>', 'nxtlabel' => '<span class="next">' . __( 'Next →', hybrid_get_parent_textdomain() ) . '</span>' ) ) ) : ?>
<div class="loop-nav">
<?php echo $nav; ?>
</div><!-- .loop-nav -->
<?php endif; ?>
示例6: array
* @package Pogidude
* @subpackage Template
*/
?>
<?php $loop_args = array( 'end_size' => 2,
'mid_size' => 2
);
?>
<?php if ( is_attachment() ) : ?>
<div class="loop-nav">
<?php previous_post_link( '%link', '<span class="previous">' . __( '← Return to entry', 'cleanaire' ) . '</span>' ); ?>
</div><!-- .loop-nav -->
<?php elseif ( is_singular( 'post' ) ) : ?>
<div class="loop-nav">
<?php previous_post_link( '<div class="previous">' . __( 'Previous Entry: %link', 'cleanaire' ) . '</div>', '%title' ); ?>
<?php next_post_link( '<div class="next">' . __( 'Next Entry: %link', 'cleanaire' ) . '</div>', '%title' ); ?>
</div><!-- .loop-nav -->
<?php elseif ( !is_singular() ) : loop_pagination( $loop_args ); ?>
<?php elseif ( !is_singular() && $nav = get_posts_nav_link( array( 'sep' => '', 'prelabel' => '<span class="previous">' . __( '← Previous', 'cleanaire' ) . '</span>', 'nxtlabel' => '<span class="next">' . __( 'Next →', 'cleanaire' ) . '</span>' ) ) ) : ?>
<div class="loop-nav">
<?php echo $nav; ?>
</div><!-- .loop-nav -->
<?php endif; ?>
示例7: _e
<h3 class="assistive-text"><?php
_e('Post navigation', 'cakifo');
?>
</h3>
<?php
previous_post_link('%link', '<span class="previous">← %title</span>');
?>
<?php
next_post_link('%link', '<span class="next">%title →</span>');
?>
</nav> <!-- .pagination.post-pagination -->
<?php
// Pagination if the theme supports "loop-pagination"
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('before' => '<nav class="pagination loop-pagination"><h3 class="assistive-text">' . __('Post navigation', 'cakifo') . '</h3>', 'after' => '</nav>', 'mid_size' => 2, 'prev_text' => __('← Previous', 'cakifo'), 'next_text' => __('Next →', 'cakifo')));
// Normal 'Previous' and 'Next' links
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('← Previous', 'cakifo') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', 'cakifo') . '</span>')))) {
?>
<nav class="pagination">
<h3 class="assistive-text"><?php
_e('Post navigation', 'cakifo');
?>
</h3>
<?php
echo $nav;
?>
</nav> <!-- .pagination.loop-pagination -->
<?php
示例8: omega_content_nav
/**
* Display navigation to next/previous pages when applicable
*/
function omega_content_nav($nav_id)
{
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if (is_single()) {
$previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if (!$next && !$previous) {
return;
}
}
// Don't print empty markup in archives if there's only one page.
if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
return;
}
$nav_class = is_single() ? 'post-navigation' : 'paging-navigation';
?>
<nav role="navigation" id="<?php
echo esc_attr($nav_id);
?>
" class="navigation <?php
echo $nav_class;
?>
">
<?php
if (is_single() && !omega_get_setting('single_nav')) {
// navigation links for single posts
?>
<?php
previous_post_link('<div class="nav-previous alignleft">%link</div>', '<span class="meta-nav">' . _x('←', 'Previous post link', 'omega') . '</span> %title');
?>
<?php
next_post_link('<div class="nav-next alignright">%link</div>', '%title <span class="meta-nav">' . _x('→', 'Next post link', 'omega') . '</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 (current_theme_supports('loop-pagination') && 'numeric' == omega_get_setting('posts_nav')) {
loop_pagination();
} else {
if (get_next_posts_link()) {
?>
<div class="nav-previous alignleft"><?php
next_posts_link(__('<span class="meta-nav">←</span> Previous Page', 'omega'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next alignright"><?php
previous_posts_link(__('Next Page <span class="meta-nav">→</span>', 'omega'));
?>
</div>
<?php
}
}
?>
<?php
}
?>
</nav><!-- #<?php
echo esc_html($nav_id);
?>
-->
<?php
}
示例9: previous_post_link
<?php
if (is_singular('post')) {
// If viewing a single post page.
?>
<div class="loop-nav">
<?php
previous_post_link('<div class="prev">' . __('Previous Post: %link', 'gomedia') . '</div>', '%title');
?>
<?php
next_post_link('<div class="next">' . __('Next Post: %link', 'gomedia') . '</div>', '%title');
?>
</div><!-- .loop-nav -->
<?php
} elseif (is_home() || is_archive() || is_search()) {
// If viewing the blog, an archive, or search results.
?>
<?php
loop_pagination(array('prev_text' => _x('Previous', 'posts navigation', 'gomedia'), 'next_text' => _x('Next', 'posts navigation', 'gomedia'), 'before' => '<nav class="loop-pagination"><ul class="pagination">', 'after' => '</ul></nav>'));
?>
<?php
}
// End check for type of page being viewed.
示例10: previous_post_link
/**
* A template part to display single entry navigation and pagination for archives.
*
* @package Compass
* @subpackage HybridCore
* @copyright Copyright (c) 2014, Flagship, LLC
* @license GPL-2.0+
* @link http://flagshipwp.com/
* @since 1.0.0
*/
?>
<?php
if (is_singular('post')) {
?>
<nav class="nav-single">
<?php
previous_post_link('<span class="nav-previous">' . __('%link', 'compass') . '</span>', '← Previous Post');
?>
<?php
next_post_link('<span class="nav-next">' . __('%link', 'compass') . '</span>', 'Next Post →');
?>
</nav><!-- .nav-singl -->
<?php
}
if (is_home() || is_archive() || is_search()) {
loop_pagination(array('prev_text' => '<span class="screen-reader-text">' . __('Previous Page', 'compass') . '</span>', 'next_text' => '<span class="screen-reader-text">' . __('Next Page', 'compass') . '</span>'));
}
示例11: elseif
<?php
} elseif (is_singular('post')) {
?>
<nav class="loop-nav">
<?php
previous_post_link('%link', '<span class="previous">' . __('← Previous', 'melange') . '</span>');
?>
<?php
next_post_link('%link', '<span class="next">' . __('Next →', 'melange') . '</span>');
?>
</nav>
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('prev_text' => __('← Previous', 'melange'), 'next_text' => __('Next →', 'melange')));
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('← Previous', 'melange') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', 'melange') . '</span>')))) {
?>
<nav class="loop-nav">
<?php
echo $nav;
?>
</nav><!-- .loop-nav -->
<?php
}
示例12: elseif
<?php
} elseif (is_singular('post')) {
?>
<nav class="loop-nav">
<?php
previous_post_link('%link', '<span class="previous">' . __('← Previous', 'infusion') . '</span>');
?>
<?php
next_post_link('%link', '<span class="next">' . __('Next →', 'infusion') . '</span>');
?>
</nav>
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('prev_text' => __('← Previous', 'infusion'), 'next_text' => __('Next →', 'infusion')));
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('← Previous', 'infusion') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', 'infusion') . '</span>')))) {
?>
<nav class="loop-nav">
<?php
echo $nav;
?>
</nav><!-- .loop-nav -->
<?php
}
示例13: previous_post_link
<?php
if (is_singular('post')) {
// If viewing a single post page.
?>
<div class="loop-nav">
<?php
previous_post_link('<div class="prev">' . __('Previous Post: %link', 'hybrid-base') . '</div>', '%title');
?>
<?php
next_post_link('<div class="next">' . __('Next Post: %link', 'hybrid-base') . '</div>', '%title');
?>
</div><!-- .loop-nav -->
<?php
} elseif (is_home() || is_archive() || is_search()) {
// If viewing the blog, an archive, or search results.
?>
<?php
loop_pagination(array('prev_text' => _x('← Previous', 'posts navigation', 'hybrid-base'), 'next_text' => _x('Next →', 'posts navigation', 'hybrid-base')));
?>
<?php
}
// End check for type of page being viewed.
示例14: elseif
<?php
} elseif (is_singular('post')) {
?>
<div class="loop-nav">
<?php
previous_post_link('%link', '<span class="previous">' . __('<span class="meta-nav">←</span> Previous', 'my-life') . '</span>');
?>
<?php
next_post_link('%link', '<span class="next">' . __('Next <span class="meta-nav">→</span>', 'my-life') . '</span>');
?>
</div><!-- .loop-nav -->
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination(array('prev_text' => __('<span class="meta-nav">←</span> Previous', 'my-life'), 'next_text' => __('Next <span class="meta-nav">→</span>', 'my-life')));
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('<span class="meta-nav">←</span> Previous', 'my-life') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', 'my-life') . '</span>')))) {
?>
<div class="loop-nav">
<?php
echo $nav;
?>
</div><!-- .loop-nav -->
<?php
}
示例15: elseif
<?php
} elseif (is_singular('post')) {
?>
<div class="loop-nav">
<?php
previous_post_link('<div class="previous">' . __('← %link', 'origin') . '</div>', '%title');
?>
<?php
next_post_link('<div class="next">' . __('%link', 'origin') . ' →</div>', '%title');
?>
</div><!-- .loop-nav -->
<?php
} elseif (!is_singular() && current_theme_supports('loop-pagination')) {
loop_pagination();
?>
<?php
} elseif (!is_singular() && ($nav = get_posts_nav_link(array('sep' => '', 'prelabel' => '<span class="previous">' . __('← Previous', 'origin') . '</span>', 'nxtlabel' => '<span class="next">' . __('Next →', 'origin') . '</span>')))) {
?>
<div class="loop-nav">
<?php
echo $nav;
?>
</div><!-- .loop-nav -->
<?php
}