wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



get_comments_pagination_arrow › WordPress Function

Od6.0.0
Przestarzałyn/a
get_comments_pagination_arrow ( $block, $pagination_type = 'next' )
Parametry: (2)
  • (WP_Block) $block Block instance.
    Wymagane: Tak
  • (string) $pagination_type Optional. Type of the arrow we will be rendering. Accepts 'next' or 'previous'. Default 'next'.
    Wymagane: Nie
    Domyślny: 'next'
Powrót:
  • (string|null) The pagination arrow HTML or null if there is none.
Zdefiniowane na:
Codex:

Helper function that returns the proper pagination arrow HTML for `CommentsPaginationNext` and `CommentsPaginationPrevious` blocks based on the provided `paginationArrow` from `CommentsPagination` context.

It's used in CommentsPaginationNext and CommentsPaginationPrevious blocks.


Źródło

function get_comments_pagination_arrow( $block, $pagination_type = 'next' ) {
	$arrow_map = array(
		'none'    => '',
		'arrow'   => array(
			'next'     => '→',
			'previous' => '←',
		),
		'chevron' => array(
			'next'     => '»',
			'previous' => '«',
		),
	);
	if ( ! empty( $block->context['comments/paginationArrow'] ) && ! empty( $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ] ) ) {
		$arrow_attribute = $block->context['comments/paginationArrow'];
		$arrow           = $arrow_map[ $block->context['comments/paginationArrow'] ][ $pagination_type ];
		$arrow_classes   = "wp-block-comments-pagination-$pagination_type-arrow is-arrow-$arrow_attribute";
		return "<span class='$arrow_classes' aria-hidden='true'>$arrow</span>";
	}
	return null;
}