comment_excerpt

函式
comment_excerpt ( $comment_ID = 0 )
引數
  • (int|WP_Comment) $comment_ID WP_Comment or ID of the comment for which to print the excerpt. Default current comment.
    Required:
定義位置
相關方法
get_comment_excerptcomment_textcomment_existsget_comment_textcomment_text_rss
引入
1.2.0
棄用
-

comment_excerpt: 這個函式返回一個評論的文字摘錄。摘錄是評論的簡短摘要,通常大約20-30個字。

顯示當前評論的摘錄。

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

	/**
	 * Filters the comment excerpt for display.
	 *
	 * @since 1.2.0
	 * @since 4.1.0 The `$comment_ID` parameter was added.
	 *
	 * @param string $comment_excerpt The comment excerpt text.
	 * @param string $comment_ID      The comment ID as a numeric string.
	 */
	echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
}

常見問題

FAQs
檢視更多 >