PluginProbe
Gutenberg / 8.5.1
Gutenberg v8.5.1
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/block-library/blocks/post-comments-count.php +10 -6 12.6.0 → 8.5.1 View file →
@@ -17,17 +17,16 @@
17 17 if ( ! isset( $block->context['postId'] ) ) {
18 18 return '';
19 19 }
20 20
21 - $classes = '';
22 - if ( isset( $attributes['textAlign'] ) ) {
23 - $classes .= 'has-text-align-' . $attributes['textAlign'];
21 + $class = 'wp-block-post-comments-count';
22 + if ( isset( $attributes['className'] ) ) {
23 + $class .= ' ' . $attributes['className'];
24 24 }
25 25
26 - $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
27 26 return sprintf(
28 - '<div %1$s>%2$s</div>',
29 - $wrapper_attributes,
27 + '<span class="%1$s">%2$s</span>',
28 + esc_attr( $class ),
30 29 get_comments_number( $block->context['postId'] )
31 30 );
32 31 }
33 32
@@ -37,8 +36,13 @@
37 36 function gutenberg_register_block_core_post_comments_count() {
38 37 register_block_type_from_metadata(
39 38 __DIR__ . '/post-comments-count',
40 39 array(
40 + 'attributes' => array(
41 + 'className' => array(
42 + 'type' => 'string',
43 + ),
44 + ),
41 45 'render_callback' => 'gutenberg_render_block_core_post_comments_count',
42 46 )
43 47 );
44 48 }