Edit File by line
/home/zeestwma/redstone.../wp-inclu.../blocks
File: post-comments-count.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/post-comments-count` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/post-comments-count` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.9.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
* @return string Returns the filtered post comments count for the current post.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_post_comments_count( $attributes, $content, $block ) {
[17] Fix | Delete
if ( ! isset( $block->context['postId'] ) ) {
[18] Fix | Delete
return '';
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
$classes = '';
[22] Fix | Delete
if ( isset( $attributes['textAlign'] ) ) {
[23] Fix | Delete
$classes .= 'has-text-align-' . $attributes['textAlign'];
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
[27] Fix | Delete
return sprintf(
[28] Fix | Delete
'<div %1$s>%2$s</div>',
[29] Fix | Delete
$wrapper_attributes,
[30] Fix | Delete
get_comments_number( $block->context['postId'] )
[31] Fix | Delete
);
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Registers the `core/post-comments-count` block on the server.
[36] Fix | Delete
*
[37] Fix | Delete
* @since 6.9.0
[38] Fix | Delete
*/
[39] Fix | Delete
function register_block_core_post_comments_count() {
[40] Fix | Delete
register_block_type_from_metadata(
[41] Fix | Delete
__DIR__ . '/post-comments-count',
[42] Fix | Delete
array(
[43] Fix | Delete
'render_callback' => 'render_block_core_post_comments_count',
[44] Fix | Delete
)
[45] Fix | Delete
);
[46] Fix | Delete
}
[47] Fix | Delete
add_action( 'init', 'register_block_core_post_comments_count' );
[48] Fix | Delete
[49] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function