get_comments_pagination_arrow

函式
get_comments_pagination_arrow ( $block, $pagination_type = 'next' )
引數
  • (WP_Block) $block Block instance.
    Required:
  • (string) $pagination_type Optional. Type of the arrow we will be rendering. Accepts 'next' or 'previous'. Default 'next'.
    Required:
    Default: 'next'
返回值
  • (string|null) The pagination arrow HTML or null if there is none.
定義位置
相關方法
get_the_comments_paginationthe_comments_paginationget_query_pagination_arrowget_the_comments_navigationget_the_posts_pagination
引入
6.0.0
棄用
-

get_comments_pagination_arrow: 這個函式用來生成特定頁面的評論分頁箭頭的HTML。

幫助函式,根據`CommentsPagination`上下文提供的`paginationArrow`,為`CommentsPaginationNext`和`CommentsPaginationPrevious`區塊返回適當的分頁箭頭HTML。

它被用於CommentsPaginationNext和CommentsPaginationPrevious區塊中。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常見問題

FAQs
檢視更多 >