Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create comments title with simple styling #40419

Merged
merged 15 commits into from
Apr 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the phpcs errors
  • Loading branch information
michalczaplinski authored and cbravobernal committed Apr 19, 2022
commit 64ce6222617b212664d8b2b1d88c09a4748d7f83
11 changes: 4 additions & 7 deletions packages/block-library/src/comments-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,25 @@
/**
* Renders the `core/comments-title` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @param array $attributes Block attributes.
*
* @return string Return the post comments title.
*/
function render_block_core_comments_title( $attributes, $content, $block ) {
function render_block_core_comments_title( $attributes ) {
$comments_title = '';
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
/* translators: %s: The post title. */
$single_comment_label = __( 'One Response to "%s"' );
$single_comment_label = __( 'One Response to "%s"' );
/* translators: 1: The number of comments, 2: The post title. */
$multiple_comment_label = __( '%1$s Responses to "%2$s"' );
if ( 1 === (int) get_comments_number() ) {
$comments_title = sprintf(
/* translators: %s: The post title. */
$single_comment_label,
get_the_title()
);
} else {
$comments_title = sprintf(
/* translators: 1: The number of comments, 2: The post title. */
$multiple_comment_label,
number_format_i18n( get_comments_number() ),
get_the_title()
Expand Down