Opened 3 years ago
Last modified 3 years ago
#55470 new enhancement
Allow for finer-grained callbacks for wp_list_comment
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
I've implemented a variety of different custom comment types, so logically, I'd like to allow for default customized comment output for these different types and still allow a theoretical theme to provide its own callback.
Unfortunately, the only two options are a custom callback or a custom Comment Walker. Using the 'wp_list_comments_args' filter to make a custom comment walker the default, and reimplementing the start_el option is the only way to do this...but this means again, the possibility of unanticipated interaction.
So, in thinking about this, proposing two enhancement options...looking for thoughts before I write up some code for consideration.
- Enhance the callback argument in wp_list_comments. Allow it to be an associative array or a string. If an associative array, the key would be comment_type. It would allow the 'all' parameter key, which would mean that the 'all' callback would be used if nothing more specific was provided. If this is a string, it would just set that to the all parameter and use the same logic. This would allow differing callbacks to be called per comment...if you choose to display them mixed.
- Add a filter inside start_el to allow for greater logic at this point before triggering the built-in or custom callback on a per-comment basis.
Now, ideally, the solutions would be found in #35214 with some form of comment registration, but as that would have to be backward compatible, and that it has been 6 years since that conversation started suggests this simpler solution may make sense in the interim and even afterward.