| @@ -18,15 +18,9 @@ | ||
| 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 | - | |
| 22 | + $post_ID = $block->context['postId']; | |
| 29 | 23 | $tag_name = 'h2'; |
| 30 | 24 | $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; |
| 31 | 25 | |
| 32 | 26 | if ( isset( $attributes['level'] ) ) { |
| @@ -32,10 +26,11 @@ | ||
| 32 | 26 | if ( isset( $attributes['level'] ) ) { |
| 33 | 27 | $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level']; |
| 34 | 28 | } |
| 35 | 29 | |
| 30 | + $title = get_the_title( $post_ID ); | |
| 36 | 31 | 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 ); | |
| 32 | + $title = sprintf( '<a href="%1s" target="%2s" rel="%3s">%4s</a>', get_the_permalink( $post_ID ), $attributes['linkTarget'], $attributes['rel'], $title ); | |
| 38 | 33 | } |
| 39 | 34 | $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); |
| 40 | 35 | |
| 41 | 36 | return sprintf( |