equal
deleted
inserted
replaced
28 function wp_latest_comments_draft_or_post_title( $post = 0 ) { |
28 function wp_latest_comments_draft_or_post_title( $post = 0 ) { |
29 $title = get_the_title( $post ); |
29 $title = get_the_title( $post ); |
30 if ( empty( $title ) ) { |
30 if ( empty( $title ) ) { |
31 $title = __( '(no title)' ); |
31 $title = __( '(no title)' ); |
32 } |
32 } |
33 return esc_html( $title ); |
33 return $title; |
34 } |
34 } |
35 |
35 |
36 /** |
36 /** |
37 * Renders the `core/latest-comments` block on server. |
37 * Renders the `core/latest-comments` block on server. |
38 * |
38 * |
40 * |
40 * |
41 * @return string Returns the post content with latest comments added. |
41 * @return string Returns the post content with latest comments added. |
42 */ |
42 */ |
43 function render_block_core_latest_comments( $attributes = array() ) { |
43 function render_block_core_latest_comments( $attributes = array() ) { |
44 $comments = get_comments( |
44 $comments = get_comments( |
45 // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php. |
45 /** This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php */ |
46 apply_filters( |
46 apply_filters( |
47 'widget_comments_args', |
47 'widget_comments_args', |
48 array( |
48 array( |
49 'number' => $attributes['commentsToShow'], |
49 'number' => $attributes['commentsToShow'], |
50 'status' => 'approve', |
50 'status' => 'approve', |
51 'post_status' => 'publish', |
51 'post_status' => 'publish', |
52 ) |
52 ), |
|
53 array() |
53 ) |
54 ) |
54 ); |
55 ); |
55 |
56 |
56 $list_items_markup = ''; |
57 $list_items_markup = ''; |
57 if ( ! empty( $comments ) ) { |
58 if ( ! empty( $comments ) ) { |