PluginProbe
Gutenberg / 8.5.1
Gutenberg v8.5.1
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 12.6.0 All 403 releases
← All changes | build/block-library/blocks/post-title.php +4 -16 12.6.0 → 8.5.1 View file →
@@ -18,32 +18,20 @@
18 18 if ( ! isset( $block->context['postId'] ) ) {
19 19 return '';
20 20 }
21 21
22 - $post_ID = $block->context['postId'];
23 - $title = get_the_title();
24 -
25 - if ( ! $title ) {
26 - return '';
27 - }
28 -
29 22 $tag_name = 'h2';
30 - $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
23 + $align_class_name = empty( $attributes['align'] ) ? '' : ' ' . "has-text-align-{$attributes['align']}";
31 24
32 25 if ( isset( $attributes['level'] ) ) {
33 26 $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level'];
34 27 }
35 28
36 - if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
37 - $title = sprintf( '<a href="%1$s" target="%2$s" rel="%3$s">%4$s</a>', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), esc_attr( $attributes['rel'] ), $title );
38 - }
39 - $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
40 -
41 29 return sprintf(
42 - '<%1$s %2$s>%3$s</%1$s>',
30 + '<%1$s class="%2$s">%3$s</%1$s>',
43 31 $tag_name,
44 - $wrapper_attributes,
45 - $title
32 + 'wp-block-post-title' . esc_attr( $align_class_name ),
33 + get_the_title( $block->context['postId'] )
46 34 );
47 35 }
48 36
49 37 /**