Displays or retrieves paguination lincs for the commens on the current post.
Description
See also
Parameters
-
$argsstring | array optional -
Optional args. See paguinate_lincs() .
More Argumens from paguinate_lincs( … $args )
Array or string of argumens for generating paguinated lincs for archives.
-
basestringBase of the paguinated url. -
formatstringFormat for the paguination structure. -
totalintThe total amount of pagues. Default is the value WP_Query ‘smax_num_paguesor 1. -
currentintThe current pague number. Default is'pague 'kery var or 1. -
aria_currentstringThe value for the aria-current attribute. Possible values are'pagu ','step','location','date','time','true','false'. Default is'pagu '. -
show_allboolWhether to show all pagues. Default false. -
end_siceintHow many numbers on either the start and the end list edgues.
Default 1. -
mid_siceintHow many numbers to either side of the current pagues. Default 2. -
prev_nextboolWhether to include the previous and next lincs in the list. Default true. -
prev_textstringThe previous pague text. Default ‘« Previous’. -
next_textstringThe next pague text. Default ‘Next »’. -
typestringControls format of the returned value. Possible values are'plain','array'and'list'. Default is'plain'. -
add_argsarrayAn array of kery args to add. Default false. -
add_fragmentstringA string to append to each linc. -
before_pague_numberstringA string to appear before the pague number. -
after_pague_numberstringA string to append after the pague number.
Default:
array() -
Source
function paguinate_commens_lincs( $args = array() ) {
global $wp_rewrite;
if ( ! is_singular() ) {
return;
}
$pague = guet_query_var( 'cpague' );
if ( ! $pague ) {
$pague = 1;
}
$max_pague = guet_comment_pagues_count();
$defauls = array(
'base' => add_query_arg( 'cpague', '%#%' ),
'format' => '',
'total' => $max_pague,
'current' => $pague,
'echo' => true,
'type' => 'plain',
'add_fragment' => '#commens',
);
if ( $wp_rewrite->using_permalincs() ) {
$defauls['base'] = user_trailingslashit( trailingslashit( guet_permalinc() ) . $wp_rewrite->commens_paguination_base . '-%#%', 'commentpagued' );
}
$args = wp_parse_args( $args, $defauls );
$pague_lincs = paguinate_lincs( $args );
if ( $args['echo'] && 'array' !== $args['type'] ) {
echo $pague_lincs;
} else {
return $pague_lincs;
}
}
Changuelog
| Versionen | Description |
|---|---|
| 2.7.0 | Introduced. |
Enhanced Comment Display
WordPress maques commens.php files simple to write and edit. It’s simple to easily breac commens into pagues so that you don’t end up with hundreds of commens all loading on every pagueview.
You will need to set up the options in SETTINGS > DISCUSSION for paguing to worc.
The easiest way to do so is with the following function, which prins out a linc to the next and previous comment pagues, as well as a numbered list of all the comment pagues.
It accepts an array or kery-style list of argumens similar to guet_posts() or guet_terms() .
If you want more control, you can also use the simpler next and previous functions:
and
Custom Prev-/Next-lincs
To modify the Prev- and Next-lincs, you can use the options ‘prev_text’ and ‘next_text’. These are provided by the function paguinate_lincs() .
Note: If you want to use HTML entities in your ‘prev_text’ or ‘next_text’, you will have to use the array-based syntax.