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

Allow filtering of comments number text in Post Comments Link #56405

Open
jeremyfelt opened this issue Nov 21, 2023 · 0 comments · May be fixed by #56406
Open

Allow filtering of comments number text in Post Comments Link #56405

jeremyfelt opened this issue Nov 21, 2023 · 0 comments · May be fixed by #56406
Labels
[Block] Post Comments Form Affects the Comments Form Block [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@jeremyfelt
Copy link
Member

What problem does this address?

In its current form, the Post Comments Link block restricts comment link text to values predefined by Gutenberg.

In WordPress core, the similarly used comments_popup_link() uses get_comments_number_text(), which passes the comment link text through the comments_number filter, allowing for modification by extenders.

My specific example that I'd like to handle is replacing the default:

No comments<span class="screen-reader-text"> on %s</span>

With a custom:

0<span class="screen-reader-text"> comments on %s</span>

What is your proposed solution?

It doesn't seem like there is any harm in supporting the existing core functionality here, so I think we can harness get_comments_number_text() with the zero/one/more string decisions that have been made in the block.

I'll submit a PR that I think handles this.

@jeremyfelt jeremyfelt added [Type] Enhancement A suggestion for improvement. [Block] Post Comments Form Affects the Comments Form Block labels Nov 21, 2023
jeremyfelt added a commit to jeremyfelt/gutenberg that referenced this issue Nov 21, 2023
This allows filtering of the text used in the Post Comments Link block by using `get_comments_number_text()` and its included filter, `comments_number`.

Fixes WordPress#56405
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 21, 2023
@jeremyfelt jeremyfelt removed their assignment Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Comments Form Affects the Comments Form Block [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
1 participant