Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: comments-pagination-previous.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/comments-pagination-previous` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/comments-pagination-previous` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.0.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes Block attributes.
[12] Fix | Delete
* @param string $content Block default content.
[13] Fix | Delete
* @param WP_Block $block Block instance.
[14] Fix | Delete
*
[15] Fix | Delete
* @return string Returns the previous posts link for the comments pagination.
[16] Fix | Delete
*/
[17] Fix | Delete
function render_block_core_comments_pagination_previous( $attributes, $content, $block ) {
[18] Fix | Delete
$default_label = __( 'Older Comments' );
[19] Fix | Delete
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
[20] Fix | Delete
$pagination_arrow = get_comments_pagination_arrow( $block, 'previous' );
[21] Fix | Delete
if ( $pagination_arrow ) {
[22] Fix | Delete
$label = $pagination_arrow . $label;
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
$filter_link_attributes = static function () {
[26] Fix | Delete
return get_block_wrapper_attributes();
[27] Fix | Delete
};
[28] Fix | Delete
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
[29] Fix | Delete
[30] Fix | Delete
$comment_vars = build_comment_query_vars_from_block( $block );
[31] Fix | Delete
$previous_comments_link = get_previous_comments_link( $label, $comment_vars['paged'] ?? null );
[32] Fix | Delete
[33] Fix | Delete
remove_filter( 'previous_comments_link_attributes', $filter_link_attributes );
[34] Fix | Delete
[35] Fix | Delete
if ( ! isset( $previous_comments_link ) ) {
[36] Fix | Delete
return '';
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
return $previous_comments_link;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Registers the `core/comments-pagination-previous` block on the server.
[44] Fix | Delete
*
[45] Fix | Delete
* @since 6.0.0
[46] Fix | Delete
*/
[47] Fix | Delete
function register_block_core_comments_pagination_previous() {
[48] Fix | Delete
register_block_type_from_metadata(
[49] Fix | Delete
__DIR__ . '/comments-pagination-previous',
[50] Fix | Delete
array(
[51] Fix | Delete
'render_callback' => 'render_block_core_comments_pagination_previous',
[52] Fix | Delete
)
[53] Fix | Delete
);
[54] Fix | Delete
}
[55] Fix | Delete
add_action( 'init', 'register_block_core_comments_pagination_previous' );
[56] Fix | Delete
[57] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function