Skip to content

Commit

Permalink
Block Editor: Rename the gutenberg_ functions in blocks/latest-commen…
Browse files Browse the repository at this point in the history
…ts.php.

This was ported manually from WordPress/gutenberg#12326

Props pento, swissspidy.
See #45145. 


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43950 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
youknowriad committed Nov 30, 2018
1 parent 73a41ba commit c52baf9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wp-includes/blocks/latest-comments.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @return string The post title if set; "(no title)" if no title is set. * @return string The post title if set; "(no title)" if no title is set.
*/ */
function gutenberg_draft_or_post_title( $post = 0 ) { function wp_latest_comments_draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post ); $title = get_the_title( $post );
if ( empty( $title ) ) { if ( empty( $title ) ) {
$title = __( '(no title)' ); $title = __( '(no title)' );
Expand All @@ -42,7 +42,7 @@ function gutenberg_draft_or_post_title( $post = 0 ) {
* *
* @return string Returns the post content with latest comments added. * @return string Returns the post content with latest comments added.
*/ */
function gutenberg_render_block_core_latest_comments( $attributes = array() ) { function render_block_core_latest_comments( $attributes = array() ) {
// This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php. // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php.
$comments = get_comments( $comments = get_comments(
apply_filters( apply_filters(
Expand Down Expand Up @@ -94,7 +94,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {


// `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in // `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in
// `esc_html`. // `esc_html`.
$post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . gutenberg_draft_or_post_title( $comment->comment_post_ID ) . '</a>'; $post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . '</a>';


$list_items_markup .= sprintf( $list_items_markup .= sprintf(
/* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */ /* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */
Expand Down Expand Up @@ -179,6 +179,6 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
'enum' => array( 'center', 'left', 'right', 'wide', 'full', '' ), 'enum' => array( 'center', 'left', 'right', 'wide', 'full', '' ),
), ),
), ),
'render_callback' => 'gutenberg_render_block_core_latest_comments', 'render_callback' => 'render_block_core_latest_comments',
) )
); );

0 comments on commit c52baf9

Please sign in to comment.