#16431 closed enhancement (duplicate)
Adding include to wp_list_comments()
Reported by: | danielpataki | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7 |
Component: | Comments | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I have been building a simple forum on Wordpress using posts as questions, top-level comments as answers, replies as comments on answers.
Choosing a best answer is available, which adds the ID of the chosen answer (comment) ti the postmeta of the question.
I would like to arrange my answers so that the first one is the chosen best answer, and below you can view the normal flow of answers.
It would be nice if this could be done using wp_list_comments(). I would call it once and use "include" to show just the one comment, and then I would call it again without the include to show the usual flow of comments.
I believe this might be generally helpful in other cases as well though.
Change History (9)
#2
@
11 years ago
- Component changed from General to Comments
- Resolution set to wontfix
- Status changed from new to closed
- Version set to 2.7
#3
follow-up:
↓ 4
@
11 years ago
Hi c3mdigital,
My description was not great, sorry :) I meant that basically adding the same functionality as allowed by WP_Query (where appropriate) would be great. Once example of this would be to have a parameter like post__in
which would allow you to grab specific comments by ID. A meta_query could also be possible.
Daniel
#4
in reply to:
↑ 3
@
11 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
Replying to danielpataki:
Hi c3mdigital,
My description was not great, sorry :) I meant that basically adding the same functionality as allowed by WP_Query (where appropriate) would be great. Once example of this would be to have a parameter like
post__in
which would allow you to grab specific comments by ID. A meta_query could also be possible.
Daniel
Thanks for the clarification. #19581 is requesting a filter for the wp_list_comments args which would allow you to pass in additional WP_Query parameters. I'm going to change the resolution on this to duplicate since 19581 has a patch. +1 on the need to use WP_Query parameters.
#5
@
11 years ago
- Resolution set to duplicate
- Status changed from reopened to closed
Duplicate of #19581.
#6
follow-up:
↓ 7
@
11 years ago
Great, thanks for giving this some attention :) Should a new ticket be opened for the WP_Query parameters, or is it covered somewhere already?
Daniel
#7
in reply to:
↑ 6
@
11 years ago
- Keywords reporter-feedback added
- Resolution duplicate deleted
- Status changed from closed to reopened
Replying to danielpataki:
Great, thanks for giving this some attention :) Should a new ticket be opened for the WP_Query parameters, or is it covered somewhere already?
Daniel
Actually that this shouldn't be marked as a duplicate. The filter on #19581 is not for any query arguments. I was thinking of get_comments()
which does allow for query arguments for WP_Comment_Query which are a little different than WP_Query.
I think in your case a new WP_Comment_Query sorting by meta_data would work. Pass the ordered results to wp_list_comments.
WP_Comment_Query query_vars:
'author_email' => '', 'ID' => '', 'karma' => '', 'number' => '', 'offset' => '', 'orderby' => '', 'order' => 'DESC', 'parent' => '', 'post_ID' => '', 'post_id' => 0, 'post_author' => '', 'post_name' => '', 'post_parent' => '', 'post_status' => '', 'post_type' => '', 'status' => '', 'type' => '', 'user_id' => '', 'search' => '', 'count' => false, 'meta_key' => '', 'meta_value' => '', 'meta_query' => '',
Do we need additional WP_Comment_Query query_vars?
#8
@
11 years ago
I think that while there, we might as well consider commentin and commentnot_in parameters. comment_parentin and comment_parentnot_in might also be an option although probably not that useful. Do you think adding a paged parameter might be useful?
While I would guess this would mostly be relegated to plugins, a post_tax_query could be useful for displaying comments for posts in specific taxonommies.
Daniel
Not sure if I understand what you mean by include. I agree that
wp_list_comments()
could use some love but we need a clear direction and additional use cases.Related: #19581