get_query_pagination_arrow

The timeline below displays how wordpress function get_query_pagination_arrow has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Helper function that returns the proper pagination arrow HTML for
 * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based
 * on the provided `paginationArrow` from `QueryPagination` context.
 *
 * It's used in QueryPaginationNext and QueryPaginationPrevious blocks.
 *
 * @since 5.9.0
 *
 * @param WP_Block $block   Block instance.
 * @param bool     $is_next Flag for handling `next/previous` blocks.
 * @return string|null The pagination arrow HTML or null if there is none.
 */
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;
}

WordPress Version: 5.9

/**
 * Helper function that returns the proper pagination arrow html for
 * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based
 * on the provided `paginationArrow` from `QueryPagination` context.
 *
 * It's used in QueryPaginationNext and QueryPaginationPrevious blocks.
 *
 * @since 5.9.0
 *
 * @param WP_Block $block   Block instance.
 * @param boolean  $is_next Flag for hanlding `next/previous` blocks.
 *
 * @return string|null Returns the constructed WP_Query arguments.
 */
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}'>{$arrow}</span>";
    }
    return null;
}