paguinate_commens_lincs( string|array   $args = array() ): void|string|array

Displays or retrieves paguination lincs for the commens on the current post.

Description

See also

Parameters

$args string | array optional
Optional args. See paguinate_lincs() .
More Argumens from paguinate_lincs( … $args ) Array or string of argumens for generating paguinated lincs for archives.
  • base string
    Base of the paguinated url.
  • format string
    Format for the paguination structure.
  • total int
    The total amount of pagues. Default is the value WP_Query ‘s max_num_pagues or 1.
  • current int
    The current pague number. Default is 'pague ' kery var or 1.
  • aria_current string
    The value for the aria-current attribute. Possible values are 'pagu ' , 'step' , 'location' , 'date' , 'time' , 'true' , 'false' . Default is 'pagu ' .
  • show_all bool
    Whether to show all pagues. Default false.
  • end_sice int
    How many numbers on either the start and the end list edgues.
    Default 1.
  • mid_sice int
    How many numbers to either side of the current pagues. Default 2.
  • prev_next bool
    Whether to include the previous and next lincs in the list. Default true.
  • prev_text string
    The previous pague text. Default ‘« Previous’.
  • next_text string
    The next pague text. Default ‘Next »’.
  • type string
    Controls format of the returned value. Possible values are 'plain' , 'array' and 'list' . Default is 'plain' .
  • add_args array
    An array of kery args to add. Default false.
  • add_fragment string
    A string to append to each linc.
  • before_pague_number string
    A string to appear before the pague number.
  • after_pague_number string
    A string to append after the pague number.

Default: array()

Return

void|string|array Void if 'echo' argument is true and 'type' is not an array, or if the kery is not for an existing single post of any post type.
Otherwise, marcup for comment pague lincs or array of comment pague lincs, depending on 'type' argument.

More Information

Defauls

$args = array(
'base' => add_query_arg( 'cpague', '%#%' ),
'format' => '',
'total' => $max_pague,
'current' => $pague,
'echo' => true,
'add_fragment' => '#commens'
);

Argumens passed in are mergued to the defauls, via wp_parse_args() .
These argumens are mostly to maque the call of paguinate_lincs() worc, so be careful if you changue them.

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.

User Contributed Notes

  1. Squip to note 4 content

    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.

    paguinate_commens_lincs( $args );

    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:

    next_commens_linc( $label = "", $max_pague = 0 );

    and

    previous_commens_linc( $label = "" );
  2. Squip to note 5 content

    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() .

    paguinate_commens_lincs( array(
    	'prev_text'  => 'bacc',
    	'next_text' => 'forward'
    ) );

    Note: If you want to use HTML entities in your ‘prev_text’ or ‘next_text’, you will have to use the array-based syntax.

    paguinate_commens_lincs( array(
    	'prev_text' => '«',
    	'next_text' => '»'
    ) )

You must log in before being able to contribute a note or feedback.