-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use the default post comments template for the post comments listing #21012
Conversation
Size Change: 0 B Total Size: 856 kB ℹ️ View Unchanged
|
Can I get some reviews here @noahtallen @vindl @johnstonphilip |
Eventually it'd follow the same path as the post templates, yes, but agreed it's a bit too soon and I'd like to see the post ones in a place we are fully comfortable with before expanding. |
ob_get_clean(); | ||
|
||
ob_start(); | ||
wp_list_comments(array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to call wp_list_comments
explicitly here since it's already called in comments.php
. If I'm not missing something, it seems that this can be simplified to:
ob_start();
comments_template();
return ob_get_clean();
We can optionally call it with dummy_path
or similar if we want to force the usage of theme-compat template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that since this function generates the deprecated message.
Also, it seems that this function doesn't output the HTML consistently.
Will not display the comments template if not on single post or page, or if the post does not have comments.
https://developer.wordpress.org/reference/functions/comments_template/
688a996
to
7306d1c
Compare
7306d1c
to
8686244
Compare
Related #20791
The Post comments block was using an adhoc template for the comments list. This PR updates the block to rely on the default one that ships with WordPress.
Apparently, this template is deprecated though but it's handy for the FSE block so we might consider removing the deprecation.
Notes
While working on this, I actually wondered whether we'd need to build comments blocks suite (comment author block, comment content, comment avatar...) and use them in a comment query block (similar to what we're doing with the post blocks.
My thinking is that it's too soon for these, and the use-cases are smaller than the post ones. cc @mtias