“Function Reference/paginate comments links”的版本间的差异
2009年3月14日 (六) 09:23的版本
In version 2.7 WordPress added the Enhanced Comment Display system to make comments.php files much simpler to write and edit. One is the ability to easily break comments into pages so that you dont' end up with hundreds of comments all loading on every pageview.
You will need to set up the options in SETTINGS DISCUSSION for paging to work.
The easiest way to do so is with the following function, which prints out a link to the next and previous comment pages, as well as a numbered list of all the comment pages.
It accepts a query-style list of arguments similar to codeget_posts()/code or codeget_terms()/code. Here are the defaults:
- 'base' = add_query_arg( 'cpage', '%#%' ),
- 'format' = ,
- 'total' = $max_page,
- 'current' = $page,
- 'echo' = true,
- 'add_fragment' = '#comments'
These arguments are mostly to make it work though, so be careful if you change them.
If you want more control, you can also use the simpler next and previous functions:
next_comments_link($label=, $max_page = 0)