comment_class

过滤器::为当前注释过滤返回的CSS类。

apply_filters( ‘comment_class’, string[] $classes , string $class , int $comment_id , WP_Comment $comment , int|WP_Post $post_id )

参数(Parameters)

参数类型说明
$classes(string[])注释类的数组。
$class(string)添加到列表中的其他类的逗号分隔列表。
$comment_id(int)评论id。
$comment(WP_Comment)注释对象。
$post_id(int | WP_Post)post ID或WP_post对象。

源码(Source)

/**
 * Generates semantic classes for each comment element.
 *
 * @since 2.7.0
 *
 * @param string|array $class      Optional. One or more classes to add to the class list.
 *                                 Default empty.
 * @param int          $comment_id Comment ID. Default current comment.
 * @param int|WP_Post  $post_id    Post ID or WP_Post object. Default current post.
 * @param bool         $echo       Optional. Whether to cho or return the output.
 *                                 Default true.
 * @return string|void
 */
function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) {
	// Separates classes with a single space, collates classes for comment DIV
	$class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"';
	if ( $echo)
		echo $class;
	else
		return $class;
}
更新版本源码位置使用被使用
2.7.0wp-includes/comment-template.php:53710
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索