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

comment_reply_link( array $args = array(), int|WP_Comment $comment = null, int|WP_Post $post = null )

显示回复评论链接的HTML内容

comment 评论more...

linkmore...

reply


描述

另见


参数

$args

(array)(可选) 替代默认选项。

默认值: array()

$comment

(int|WP_Comment)(可选) 正在回复的评论。默认当前评论。

默认值: null

$post

(int|WP_Post)(可选) 评论将在其上显示的文章 ID或WP_Post对象。默认当前文章。

默认值: null



源码

查看源码 官方文档


更新日志

版本描述
2.7.0开始引入

使用示例

  • 示例1
    <?php comment_reply_link( array_merge($args, array(
        'reply_text' => __('Responder <span>&darr;</span>', 'textdomain'),
        'depth'      => $depth,
        'max_depth'  => $args['max_depth']
        )
    )); ?>
  • 示例2

    使用以下代码替换回复链接上的类。

    function wpdocs_comment_reply_link_class( $class ) {
    	$class = str_replace( "class='comment-reply-link", "class='comment-reply-link your-class-name", $class );
    	return $class;
    }
    
    add_filter( 'comment_reply_link', 'wpdocs_comment_reply_link_class' );
    
  • 示例3

    用法

    <?php comment_reply_link( $args, $comment, $post ); ?>