开发者 |
maxfoundry
emartin24 AlanP57 |
---|---|
更新时间 | 2024年11月25日 20:54 |
PHP版本: | 2.6.0 (2.7.0 for comments pagination) 及以上 |
WordPress版本: | 6.7.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wp-paginate
folder and its contents into the wp-content/plugins/
directory of your WordPress installationindex.php
, archive.php
, categories.php
, search.php
, tag.php
, or the functions.php
file(s).The twentyeleven
theme places the pagination code in functions.php
in the twentyeleven_content_nav()
function.
Examples:Twenty Seventeen
theme, in index.php
, replace:
the_posts_pagination( array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '' . ( 'Previous page', 'twentyseventeen' ) . '',
'next_text' => '' . ( 'Next page', 'twentyseventeen' ) . '' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '' . __( 'Page', 'twentyseventeen' ) . ' ',
) );
With:
if(function_exists('wp_paginate')):
wp_paginate();
else :
the_posts_pagination( array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '' . ( 'Previous page', 'twentyseventeen' ) . '',
'next_text' => '' . ( 'Next page', 'twentyseventeen' ) . '' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '' . __( 'Page', 'twentyseventeen' ) . ' ',
) );
endif;
For the Twenty Sixteen
theme, in index.php
, replace:
the_posts_pagination( array(
'prev_text' => ( 'Previous page', 'twentysixteen' ),
'next_text' => ( 'Next page', 'twentysixteen' ),
'before_page_number' => '' . __( 'Page', 'twentysixteen' ) . ' ',
) );
With:
if(function_exists('wp_paginate')):
wp_paginate();
else :
the_posts_pagination( array(
'prev_text' => ( 'Previous page', 'twentysixteen' ),
'next_text' => ( 'Next page', 'twentysixteen' ),
'before_page_number' => '' . __( 'Page', 'twentysixteen' ) . ' ',
) );
endif;
For the Twenty Fifteen
theme, in index.php
, replace:
the_posts_pagination( array(
'prev_text' => ( 'Previous page', 'twentyfifteen' ),
'next_text' => ( 'Next page', 'twentyfifteen' ),
'before_page_number' => '' . __( 'Page', 'twentyfifteen' ) . ' ',
) );
With:
if(function_exists('wp_paginate')):
wp_paginate();
else :
the_posts_pagination( array(
'prev_text' => ( 'Previous page', 'twentyfifteen' ),
'next_text' => ( 'Next page', 'twentyfifteen' ),
'before_page_number' => '' . __( 'Page', 'twentyfifteen' ) . ' ',
) );
endif;
For comments pagination:
comments.php
file.previous_comments_link()
and next_comments_link()
code block with the following:wp-paginate.css
file in your theme's directory and place your custom CSS there
styles.css
wp-paginate.css
file in the wp-paginate plugin directoryBefore Markup
to <div class="navigation">
wp-paginate.css
, change .wp-paginate ol
to .wp-paginate
The wp_paginate()
and wp_paginate_comments()
functions each takes one optional argument, in query string format, which allows you to override the global settings. The available options are:
wp_paginate_comments()
):
When calling wp_paginate_comments()
, WP-Paginate adds an extra class to the ol
element, wp-paginate-comments
.
wp-paginate
and wp-paginate-comments
class names on the ol
elementbefore
option from <div class="wp-paginate">
to <div class="navigation">
.wp-paginate-comments
styles to wp-paginate.css
wp-paginate.css
wp_paginate_comments()
function for pagination of post comments