函数原型
get_comments_pagination_arrow( WP_Block $block, string $pagination_type = ‘next’ ): string|null
函数描述
Helper function that returns the proper pagination arrow HTML for CommentsPaginationNext and CommentsPaginationPrevious blocks based on the provided paginationArrow from CommentsPagination context.
是否弃用
未弃用
函数参数
-
$block
WP_Block
Required - Block instance.
-
$pagination_type
string
Optional - Type of the arrow we will be rendering.
Accepts'next'or'previous'. Default'next'.Default:
'next'
函数返回值
string|null The pagination arrow HTML or null if there is none.
函数位置
File: wp-includes/blocks.php.
函数源码
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |

