Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: comments-pagination-next.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/comments-pagination-next` 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-next` 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 next comments link for the query pagination.
[16] Fix | Delete
*/
[17] Fix | Delete
function render_block_core_comments_pagination_next( $attributes, $content, $block ) {
[18] Fix | Delete
// Bail out early if the post ID is not set for some reason.
[19] Fix | Delete
if ( empty( $block->context['postId'] ) ) {
[20] Fix | Delete
return '';
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
$comment_vars = build_comment_query_vars_from_block( $block );
[24] Fix | Delete
$max_page = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages;
[25] Fix | Delete
$default_label = __( 'Newer Comments' );
[26] Fix | Delete
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
[27] Fix | Delete
$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
[28] Fix | Delete
[29] Fix | Delete
$filter_link_attributes = static function () {
[30] Fix | Delete
return get_block_wrapper_attributes();
[31] Fix | Delete
};
[32] Fix | Delete
add_filter( 'next_comments_link_attributes', $filter_link_attributes );
[33] Fix | Delete
[34] Fix | Delete
if ( $pagination_arrow ) {
[35] Fix | Delete
$label .= $pagination_arrow;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$next_comments_link = get_next_comments_link( $label, $max_page, $comment_vars['paged'] ?? null );
[39] Fix | Delete
[40] Fix | Delete
remove_filter( 'next_posts_link_attributes', $filter_link_attributes );
[41] Fix | Delete
[42] Fix | Delete
if ( ! isset( $next_comments_link ) ) {
[43] Fix | Delete
return '';
[44] Fix | Delete
}
[45] Fix | Delete
return $next_comments_link;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Registers the `core/comments-pagination-next` block on the server.
[51] Fix | Delete
*
[52] Fix | Delete
* @since 6.0.0
[53] Fix | Delete
*/
[54] Fix | Delete
function register_block_core_comments_pagination_next() {
[55] Fix | Delete
register_block_type_from_metadata(
[56] Fix | Delete
__DIR__ . '/comments-pagination-next',
[57] Fix | Delete
array(
[58] Fix | Delete
'render_callback' => 'render_block_core_comments_pagination_next',
[59] Fix | Delete
)
[60] Fix | Delete
);
[61] Fix | Delete
}
[62] Fix | Delete
add_action( 'init', 'register_block_core_comments_pagination_next' );
[63] Fix | Delete
[64] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function