本文整理汇总了PHP中the_posts_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP the_posts_pagination函数的具体用法?PHP the_posts_pagination怎么用?PHP the_posts_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_posts_pagination函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function create_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$pagination_type = get_theme_mod('pagination_type', create_get_default_theme_options('pagination_type'));
/**
* Check if navigation type is Jetpack Infinite Scroll and if it is enabled, else goto default pagination
* if it's active then disable pagination
*/
if (('infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type) && class_exists('Jetpack') && Jetpack::is_module_active('infinite-scroll')) {
return false;
} elseif ('numeric' == $pagination_type && function_exists('the_posts_pagination')) {
// Previous/next page navigation.
the_posts_pagination(array('prev_text' => __('Previous page', 'create'), 'next_text' => __('Next page', 'create'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'create') . ' </span>'));
} else {
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'create');
?>
</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', 'create'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'create'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
}
开发者ID:peisheng,项目名称:wp,代码行数:55,代码来源:template-tags.php
示例2: epigone_paging_nav
/**
* ページナビゲーションを出力
*
* @return void
*/
function epigone_paging_nav()
{
$defaults = array('show_all' => false, 'prev_next' => true, 'prev_text' => __('« Previous'), 'next_text' => __('Next »'), 'end_size' => 1, 'mid_size' => 2, 'type' => 'list', 'add_args' => array(), 'add_fragment' => '', 'before_page_number' => '', 'after_page_number' => '');
echo "<div class='text-center'>";
the_posts_pagination($defaults);
echo "</div>";
}
开发者ID:growgroup,项目名称:epigone,代码行数:12,代码来源:template-tags.php
示例3: avocation_pagination
function avocation_pagination()
{
if (is_single()) {
the_post_navigation(array('prev_text' => '<div class="avocation_previous_pagination alignleft">%title</div>', 'next_text' => '<div class="avocation_next_pagination alignright">%title</div>'));
} else {
the_posts_pagination(array('prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>', 'before_page_number' => '<span class="meta-nav screen-reader-text"></span>'));
}
}
开发者ID:stvnfrancisco,项目名称:art_portfolio_wordpress,代码行数:8,代码来源:theme-default-setup.php
示例4: utility_pro_post_pagination
/**
* Use WordPress archive pagination.
*
* Return a paginated navigation to next/previous set of posts, when
* applicable. Includes screen reader text for better accessibility.
*
* @since 1.0.0
*
* @see the_posts_pagination()
* @return string Markup for pagination links.
*/
function utility_pro_post_pagination()
{
$args = array('mid_size' => 2, 'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'utility-pro') . ' </span>');
if ('numeric' === genesis_get_option('posts_nav')) {
the_posts_pagination($args);
} else {
the_posts_navigation($args);
}
}
开发者ID:ashenkar,项目名称:sanga,代码行数:20,代码来源:theme-config.php
示例5: multishop_pagination
function multishop_pagination()
{
?>
<div class="col-md-12 multishop-default-pagination ">
<?php
if (is_single()) {
the_post_navigation(array('next_text' => '<span class="multishop_next_pagination meta-nav" aria-hidden="true">%title</span>', 'prev_text' => '<span class="multishop_previous_pagination meta-nav" aria-hidden="true">%title</span>'));
} else {
the_posts_pagination(array('prev_text' => __('<<'), 'next_text' => __('>>'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'multishop') . ' </span>'));
}
?>
</div>
<?php
}
开发者ID:obecolette,项目名称:wordpress,代码行数:14,代码来源:theme-default-setup.php
示例6: wimplepro_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function wimplepro_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
if (ot_get_option('pagination') == 'infinite') {
wimplepro_infinite_loading('infinite');
} elseif (ot_get_option('pagination') == 'numberal') {
// Previous/next page navigation.
the_posts_pagination(array('prev_text' => __('Previous page', 'themecountry'), 'next_text' => __('Next page', 'themecountry'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'themecountry') . ' </span>'));
} elseif (ot_get_option('pagination') == 'loading') {
wimplepro_infinite_loading();
} else {
?>
<nav class="navigation paging-navigation" role="navigation">
<span class="screen-reader-text"><?php
_e('Posts navigation', 'themecountry');
?>
</span>
<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', 'themecountry'));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">→</span>', 'themecountry'));
?>
</div>
<?php
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
}
开发者ID:hiroki-tkg,项目名称:bitmaker,代码行数:52,代码来源:template-tags.php
示例7: my_ajax_pagination
function my_ajax_pagination()
{
$query_vars = json_decode(stripslashes($_POST['query_vars']), true);
$query_vars['paged'] = $_POST['page'];
$posts = new WP_Query($query_vars);
$GLOBALS['wp_query'] = $posts;
add_filter('editor_max_image_size', 'my_image_size_override');
if (!$posts->have_posts()) {
get_template_part('content', 'none');
} else {
while ($posts->have_posts()) {
$posts->the_post();
get_template_part('content', get_post_format());
}
}
remove_filter('editor_max_image_size', 'my_image_size_override');
the_posts_pagination(array('prev_text' => __('Previous page', 'twentyfifteen'), 'next_text' => __('Next page', 'twentyfifteen'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'twentyfifteen') . ' </span>'));
die;
}
开发者ID:sachyya,项目名称:experiment,代码行数:19,代码来源:functions.php
示例8: photolab_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function photolab_paging_nav()
{
if (function_exists('the_posts_pagination')) {
the_posts_pagination(array('prev_text' => __('← Previous', 'photolab'), 'next_text' => __('Next →', 'photolab'), 'screen_reader_text' => ''));
return;
}
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'photolab'), 'next_text' => __('Next →', 'photolab')));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'photolab');
?>
</h1>
<div class="pagination loop-pagination">
<?php
echo $links;
?>
</div><!-- .pagination -->
</nav><!-- .navigation -->
<?php
}
}
开发者ID:baydiwo,项目名称:RajutanIbu,代码行数:43,代码来源:template-tags.php
示例9: awesome_pagination
/**
* Customized Archive Pagination Helper function
* @since 0.1
* @return string HTML output of our pagination
*/
function awesome_pagination()
{
?>
<section class="pagination">
<?php
if (!is_single()) {
//ARCHIVE
?>
<?php
//added in 4.1, so check
if (function_exists('the_posts_pagination')) {
//numbered, pretty pagination
the_posts_pagination(array('prev_text' => '←', 'next_text' => 'Next →', 'mid_size' => 3));
} else {
previous_posts_link('← Newer Posts');
next_posts_link('Older Posts →');
}
?>
<?php
} else {
//SINGLE
?>
<?php
next_post_link('%link', '← %title');
//1 newer post
?>
<?php
previous_post_link('%link', '%title →');
//1 older post
?>
<?php
}
?>
</section>
<?php
}
开发者ID:melissacabral,项目名称:awesome-co-1215,代码行数:45,代码来源:functions.php
示例10: simple_life_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function simple_life_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$pagination_type = esc_attr(simple_life_get_option('pagination_type'));
switch ($pagination_type) {
case 'numeric':
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
} else {
the_posts_pagination(array('mid_size' => 2, 'prev_text' => '<span class="meta-nav"><i class="fa fa-chevron-left" aria-hidden="true"></i></span> ' . __('Previous page', 'simple-life'), 'next_text' => __('Next page', 'simple-life') . ' <span class="meta-nav"><i class="fa fa-chevron-right" aria-hidden="true"></i></span>', 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'simple-life') . ' </span>'));
}
break;
case 'default':
the_posts_navigation(array('prev_text' => '<span class="meta-nav"><i class="fa fa-chevron-left" aria-hidden="true"></i></span> ' . __('Older posts', 'simple-life'), 'next_text' => __('Newer posts', 'simple-life') . ' <span class="meta-nav"><i class="fa fa-chevron-right" aria-hidden="true"></i></span>'));
break;
default:
break;
}
}
开发者ID:ernilambar,项目名称:simple-life,代码行数:25,代码来源:template-tags.php
示例11: proper_post_navigation
function proper_post_navigation()
{
// don't bother for pages
if (!is_page()) {
//where multiple posts appear use Hybrid loop_pagination
if (!is_singular()) {
the_posts_pagination();
//otherwise, for single pages, films etc. us WP previous and next post links
} else {
?>
<nav class="navigation pagination">
<?php
previous_post_link('<span class="prev-wrapper">%link</span>');
next_post_link('<span class="next-wrapper">%link</span>');
?>
</nav>
<?php
}
?>
<?php
}
}
开发者ID:Bones5,项目名称:Proper-Bear,代码行数:24,代码来源:proper-post-navigation.php
示例12: while
while (have_posts()) {
the_post();
?>
<?php
get_template_part('module_loop_post');
?>
<?php
}
?>
</div>
<?php
}
// extend loop()
?>
<?php
the_posts_pagination(array('mid_size' => 1, 'prev_text' => '«', 'next_text' => '»', 'type' => 'list', 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'lightning') . ' </span>'));
} else {
?>
<div class="well"><p><?php
_e('No posts.', 'lightning');
?>
</p></div>
<?php
}
// have_post()
?>
</main><!-- [ /.mainSection ] -->
<div class="col-md-3 col-md-offset-1 subSection">
<?php
开发者ID:hinaloe,项目名称:Lightning,代码行数:31,代码来源:index.php
示例13: get_template_part
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part('template-parts/content', get_post_format());
?>
<?php
}
?>
<?php
the_posts_pagination();
?>
<?php
} else {
?>
<?php
get_template_part('template-parts/content', 'none');
?>
<?php
}
?>
</main><!-- #main -->
开发者ID:andrewmowe,项目名称:epic-scan,代码行数:30,代码来源:category.php
示例14: while
/* Start the Loop */
?>
<?php
while (have_posts()) {
the_post();
?>
<?php
get_template_part('content', get_post_format());
?>
<?php
}
?>
</div>
<?php
// Previous/next post navigation.
the_posts_pagination(array('mid_size' => 2, 'prev_text' => __('Back', 'naturo_lite'), 'next_text' => __('Onward', 'naturo_lite')));
?>
<?php
} else {
?>
<?php
get_template_part('no-results', 'archive');
?>
<?php
}
?>
</section>
<?php
get_sidebar();
?>
开发者ID:ReConcepts,项目名称:mashariki,代码行数:31,代码来源:archive.php
示例15: the_title
the_title();
?>
</a></h3>
<?php
get_template_part('parts/meta');
?>
<?php
get_template_part('parts/excerpt');
?>
</article>
<?php
}
?>
<?php
} else {
?>
<h2>No posts to display</h2>
<?php
}
?>
<?php
the_posts_pagination(array('prev_text' => '← Previous', 'next_text' => 'Next →', 'before_page_number' => '<span class="meta-nav screen-reader-text">Page</span>'));
?>
<?php
get_footer();
开发者ID:sdempsey,项目名称:dempsey-recipes,代码行数:31,代码来源:tag.php
示例16: storefront_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function storefront_paging_nav() {
global $wp_query;
$args = array(
'type' => 'list',
'next_text' => _x( 'Next', 'Next post', 'storefront' ) . ' <span class="meta-nav">→</span>',
'prev_text' => '<span class="meta-nav">←</span> ' . _x( 'Previous', 'Previous post', 'storefront' ),
);
the_posts_pagination( $args );
}
开发者ID:GermansRegi,项目名称:wordpress-bacicleta,代码行数:14,代码来源:post.php
示例17: the_pagination_html
/**
* Display a paginated navigation to next/previous set of posts,
* when applicable.
*
* @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
* Default empty array.
*/
function the_pagination_html($args = array())
{
the_posts_pagination($args);
}
开发者ID:wpscholar,项目名称:wplib,代码行数:11,代码来源:class-theme-base.php
示例18: get_template_part
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part('template-parts/content', get_post_format());
?>
<?php
}
?>
<?php
the_posts_pagination(array('prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>'));
?>
<?php
} else {
?>
<?php
get_template_part('template-parts/content', 'none');
?>
<?php
}
?>
</main><!-- #main -->
开发者ID:phdulac,项目名称:wordpress,代码行数:30,代码来源:index.php
示例19: while
<?php
while (have_posts()) {
the_post();
?>
<?php
get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format());
?>
<?php
}
?>
<div class="pagination-container text-center">
<!--<ul class="pagination">
<li class="disabled"><a href="#">«</a></li>
<li class="active"><a href="#">1<span class="sr-only">(current)</span></a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">»</a></li>
</ul>//pagination-->
<?php
the_posts_pagination(array('mid_size' => 3, 'prev_text' => __('«', 'sage'), 'next_text' => __('»', 'sage')));
?>
</div>
</div><!--//container-->
</section><!--//blog-list-->
开发者ID:Olaw2jr,项目名称:WeDesign-Tz,代码行数:30,代码来源:index.php
示例20: the_permalink
</h2>
<p><a href="<?php
the_permalink();
?>
"><?php
the_excerpt();
?>
</a></p>
</li>
<?php
}
// End of the loop.
?>
</ul>
<?php
$argsss = array('show_all' => False, 'end_size' => 1, 'mid_size' => 1, 'prev_next' => True, 'prev_text' => __('<'), 'next_text' => __('>'), 'add_args' => False, 'add_fragment' => '', 'screen_reader_text' => __(''));
the_posts_pagination($argsss);
?>
<?php
wp_reset_query();
?>
</main><!-- #main -->
</div><!-- #primary -->
<div id="secondary2" class="widget-area sidebar" role="complementary">
<?php
dynamic_sidebar('sidebar-3');
?>
</div>
<?php
get_footer();
开发者ID:Alexander-smirnov,项目名称:infomist,代码行数:31,代码来源:author.php
注:本文中的the_posts_pagination函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论