当前浏览:首页 / WordPress函数 / comment_text()

comment_text( int|WP_Comment $comment_ID, array $args = array() )

显示当前评论的文本

comment 评论more...

textmore...


描述

另见

  • Walker_Comment::comment()

参数

$comment_ID

(int|WP_Comment)(必填) WP_Comment或要为其打印文本的评论的ID。默认当前评论。

$args

(array)(可选) 参数数组。

默认值: array()



源码

查看源码 官方文档


更新日志

版本描述
4.4.0增加了$comment_ID也能接受WP_Comment对象的能力。
0.71开始引入

使用示例

  • 示例1

    基本示例

    在列表(<ul>)标签中显示带有评论作者的评论文本。

    <ul>
    	<li>
    		<?php printf( __( 'Comment by %s:', 'textdomain' ), get_comment_author() ); ?><br />
    		<?php comment_text(); ?>
    	</li>
    </ul>