| @@ -15,24 +15,15 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | function gutenberg_render_block_core_post_comments( $attributes, $content, $block ) { |
| 17 | 17 | global $post; |
| 18 | 18 | |
| 19 | - $post_id = $block->context['postId']; | |
| 20 | - if ( ! isset( $post_id ) ) { | |
| 19 | + if ( ! isset( $block->context['postId'] ) ) { | |
| 21 | 20 | return ''; |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | - $comment_args = array( | |
| 25 | - 'post_id' => $post_id, | |
| 26 | - 'count' => true, | |
| 27 | - ); | |
| 28 | - // Return early if there are no comments and comments are closed. | |
| 29 | - if ( ! comments_open( $post_id ) && get_comments( $comment_args ) === 0 ) { | |
| 30 | - return ''; | |
| 31 | - } | |
| 23 | + $post_before = $post; | |
| 32 | 24 | |
| 33 | - $post_before = $post; | |
| 34 | - $post = get_post( $post_id ); | |
| 25 | + $post = get_post( $block->context['postId'] ); | |
| 35 | 26 | setup_postdata( $post ); |
| 36 | 27 | |
| 37 | 28 | ob_start(); |
| 38 | 29 | // There's a deprecation warning generated by WP Core. |
| @@ -65,21 +56,4 @@ | ||
| 65 | 56 | ) |
| 66 | 57 | ); |
| 67 | 58 | } |
| 68 | 59 | add_action( 'init', 'gutenberg_register_block_core_post_comments', 20 ); |
| 69 | - | |
| 70 | -/** | |
| 71 | - * Use the button block classes for the form-submit button. | |
| 72 | - * | |
| 73 | - * @param array $fields The default comment form arguments. | |
| 74 | - * | |
| 75 | - * @return array Returns the modified fields. | |
| 76 | - */ | |
| 77 | -function gutenberg_post_comments_block_form_defaults( $fields ) { | |
| 78 | - if ( wp_is_block_theme() ) { | |
| 79 | - $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />'; | |
| 80 | - $fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>'; | |
| 81 | - } | |
| 82 | - | |
| 83 | - return $fields; | |
| 84 | -} | |
| 85 | -add_filter( 'comment_form_defaults', 'gutenberg_post_comments_block_form_defaults' ); | |