[wp-trac] [WordPress Trac] #34442: How to target only the get_comments() query in comment_template()
WordPress Trac
noreply at wordpress.org
Sun Jan 10 13:00:43 UTC 2016
#34442: How to target only the get_comments() query in comment_template()
-------------------------+---------------------------
Reporter: birgire | Owner: boonebgorges
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.5
Component: Comments | Version: 4.3.1
Severity: normal | Resolution: fixed
Keywords: | Focuses:
-------------------------+---------------------------
Comment (by birgire):
I also wonder if we should make it more developer friendly and pass on the
{{{$file}}} and {{{$seperate_comments}}} from the
{{{
comments_template( $file, $seperate_comments )
}}}
Additionally the {{{$commenter}}} array, the {{{$post}}} object and the
{{{$user_ID}}} used in the {{{comments_template()}}} function.
Example:
{{{
/**
* Filters the arguments used to query comments in
comments_template().
*
* @since 4.5.0
*
* @param array $comment_args {
* Array of arguments. See WP_Comment_Query::__construct() for
detailed descriptions.
*
* @type string|array $orderby Field(s) to
order by.
* @type string $order Order of
results. Accepts 'ASC' or 'DESC'.
* @type string $status Comment
status.
* @type int $post_id ID of the
post.
* @type bool $no_found_rows Whether to
refrain from querying for found rows.
* @type bool $update_comment_meta_cache Whether to
prime cache for comment meta.
* @type bool|string $hierarchical Whether to
query for comments hierarchically.
* @type int $offset Comment
offset.
* @type int $number Number of
comments to fetch.
* }
* @param string $file The comments template file to
load. Default '/comments.php'.
* @param bool $separate_comments Whether to separate the
comments by comment type. Default false.
* @param array $commenter {
* Array of arguments. See wp_get_current_commenter() for
detailed descriptions.
* @type string|array $orderby Field(s) to
order by.
* @type string $order Order of
results. Accepts 'ASC' or 'DESC'.
* @type string $status Comment
status.
* }
* @param WP_Post $post Post object
* @param int $user_ID The Current user ID. Is 0 if not logged in.
*/
$comment_args = apply_filters( 'comments_template_query_args',
$comment_args, $file, $seperate_comments, $commenter, $post, $user_ID );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34442#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list