get_comment_time

过滤器::过滤返回的注释时间。

apply_filters( ‘get_comment_time’, string|int $date , string $format , bool $gmt , bool $translate , WP_Comment $comment )

参数(Parameters)

参数类型说明
$date(string | int)注释时间,格式为日期字符串或Unix时间戳。
$format(string)日期格式。
$gmt(bool)是否正在使用GMT日期。
$translate(bool)是否翻译时间。
$comment(WP_Comment)注释对象。

源码(Source)

/**
 * Retrieve the comment time of the current comment.
 *
 * @since 1.5.0
 *
 * @global object $comment
 *
 * @param string $d         Optional. The format of the time. Default user's settings.
 * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
 * @param bool   $translate Optional. Whether to translate the time (for use in feeds).
 *                          Default true.
 * @return string The formatted time.
 */
function get_comment_time( $d = '', $gmt = false, $translate = true ) {
	global $comment;
	$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
	if ( '' == $d )
		$date = mysql2date(get_option('time_format'), $comment_date, $translate);
	else
		$date = mysql2date($d, $comment_date, $translate);
	/**
	 * Filter the returned comment time.
	 *
	 * @since 1.5.0
	 *
	 * @param string|int $date      The comment time, formatted as a date string or Unix timestamp.
	 * @param string     $d         Date format.
	 * @param bool       $gmt       Whether the GMT date is in use.
	 * @param bool       $translate Whether the time is translated.
	 * @param object     $comment   The comment object.
	 */
	return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment );
}
更新版本源码位置使用被使用
1.5.0wp-includes/comment-template.php:105710
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索