WordPress函数:comment_excerpt 显示当前评论的摘要

江河/ 2023年05月31日/ WordPress/ 浏览 1104

函数原型:


comment_excerpt( int|WP_Comment $comment_id )


显示当前评论的摘要。


参数说明:


$comment_id, 要打印摘录的评论的WP_Comment或ID。默认当前评论。


函数源码:


function comment_excerpt( $comment_id = 0 ) {
	$comment         = get_comment( $comment_id );
	$comment_excerpt = get_comment_excerpt( $comment );

	echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
}


包含钩子:


apply_filters( 'comment_excerpt', string $comment_excerpt, string $comment_id )


使用举例:


<p>Latest comment: <?php comment_excerpt(); ?></p>


发表评论

暂无评论,抢个沙发...

客服 工单