函数原型
get_query_pagination_arrow( WP_Block $block, bool $is_next ): string|null
函数描述
Helper function that returns the proper pagination arrow HTML for QueryPaginationNext and QueryPaginationPrevious blocks based on the provided paginationArrow from QueryPagination context.
是否弃用
未弃用
函数参数
-
$block
WP_Block
Required - Block instance.
-
$is_next
bool
Required - Flag for handling
next/previousblocks.
函数返回值
string|null The pagination arrow HTML or null if there is none.
函数位置
File: wp-includes/blocks.php.
函数源码
function get_query_pagination_arrow( $block, $is_next ) {
$arrow_map = array(
'none' => '',
'arrow' => array(
'next' => '→',
'previous' => '←',
),
'chevron' => array(
'next' => '»',
'previous' => '«',
),
);
if ( ! empty( $block->context['paginationArrow'] ) && array_key_exists( $block->context['paginationArrow'], $arrow_map ) && ! empty( $arrow_map[ $block->context['paginationArrow'] ] ) ) {
$pagination_type = $is_next ? 'next' : 'previous';
$arrow_attribute = $block->context['paginationArrow'];
$arrow = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ];
$arrow_classes = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute";
return "<span class='$arrow_classes' aria-hidden='true'>$arrow</span>";
}
return null;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |

