Opened 12 years ago
Last modified 5 years ago
#21758 new enhancement
Do not require a file in comments_template()
Reported by: | mattonomics | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.1 |
Component: | Comments | Keywords: | needs-patch |
Focuses: | Cc: |
Description
comments_template() is a very useful and reliable way to set up comments for a page, but it has a major downfall: it forces a file to be included when, in reality, one does not need to be.
Numerous times it has been the case that I needed comments to be setup in the wp_query object, but did not want to output anything at that time. The hack I have used is simply to include an empty comments.php file. This method is less than desirable for obvious reasons.
So, I propose that we simply add a parameter I'm calling $require that will control whether or not a file is included at all.
Attachments (1)
Change History (6)
#3
@
9 years ago
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to Future Release
Version 0, edited 9 years ago
by
(next)
Note: See
TracTickets for help on using
tickets.
Rather than a new parameter, I think this makes the most sense as a separate function.
comments_template() can remain for template inclusion purposes, but a new function should handle setup. It might make the most sense as a method on WP_Query, such as get_comments() to match get_posts().
Things like set_query_var() would need to become $query->set() to be agnostic for any WP_Query object.