A long time ago, the pagination of page numbers needed custom functions or plug-ins. I don’t know which version started, but WordPress has provided the paginate_links () function, and those functions written by myself can be laid off. The function provides a lot of parameters, which can perfectly customize the output format. Maybe many themes are still using the old codes, which is really heartbreaking.
The specific style is shown below.
Paginate_links () function with enhanced beautification of wordpress paging function
The application of pagination mainly includes article list pagination and comment list pagination.
Pagination of article list
‘before_page_number’ => ”,
‘mid_size’ => 2,
)); ? >
Does it feel particularly simple? . If you want to display the previous page and the next page, just set prev_next to 1.
Please refer to the related articles at the end of the article for ajax loading.
Pagination of comment list
php paginate_comments_links('prev_next=0'); ? >
Please refer to the related articles at the end of the article for the paging effect of ajax comments.
Reference CSS style
.posts-nav{ font-size: 14px;
color:rgba(0,0,0,0.44); padding:10px 0}
.posts-nav .page-numbers{border-radius: 3px; border:1px solid rgba(0, 0, 0, 0.15); display: inline-block;
text-align: center;
width: 30px; line-height:30px; margin:0 5px; }
.posts-nav .page-numbers.current,.posts-nav .page-numbers:not(.dots):hover{ background: #3b5998;
border-color: #3b5998; color:#fff; }
.posts-nav .page-numbers.dots{border-color:rgba(0,0,0,0)}
Of course, functions can also be used to customize the loop, so this article will not introduce them in detail. .
Linkspaginate paging