wordpress回复评论文字的修正办法

  WordPress主题教程之修正wordpress回复评论文字办法,**需求建设个自定义的评论模板,而后经过调用此评论函数来完成自定义,经过以下代码能够完成修正回复文字:

<?php
$defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
'login_text' => __('Reply'), 'depth' => 0, 'before' => '', 'after' => '');
comment_reply_link(array_merge( $defaults, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

  你能够将 Reply 修正成你心愿的文字。

$defaults = array(‘add_below’ => ‘comment’, ‘respond_id’ => ‘respond’, ‘reply_text’ => __(‘Reply’)

  这行是默许的回复评论。

‘login_text’ => __(‘Reply’), ‘depth’ => 0, ‘before’ =>, ‘after’ =>); 

  这行是登陆后评论。

comment_reply_link(array_merge( $defaults, array(‘depth’ => $depth, ‘max_depth’ => $args['max_depth']))) 

  这行是评论链接。

 将以上代码放在评论 loop 内既可应用,上面是完好的 custom_comment.php 函数文件:

<?php
if (!function_exists("custom_comment")) {
function custom_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<a name="comment-<?php comment_ID() ?>"></a>
<?php if(get_comment_type() == "comment"){ ?>
<?php the_commenter_avatar($args) ?>
<?php } ?>
<?php
$defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
'login_text' => __('Reply'), 'depth' => 0, 'before' => '', 'after' => '');
comment_reply_link(array_merge( $defaults, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
<?php the_commenter_link() ?>
<?php echo get_comment_date(get_option( 'date_format' )) ?> <?php _e('at', 'jintu'); ?> <?php echo get_comment_time(get_option( 'time_format' )); ?>
<?php edit_comment_link(__('Edit', 'jintu'), '', ''); ?>
<?php comment_text() ?>
<?php if ($comment->comment_approved == '0') { ?>
<p class='unapproved'><?php _e('Your comment is awaiting moderation.', 'jintu'); ?></p>
<?php } ?>
<?php
}
} ?>

  将下面的代码保留到 custom_comment.php 文件, 在functions.php里加载即可,wordpress修正回复文字的办法就这么简略,试试吧。

以上就是安达网络工作室关于《wordpress回复评论文字的修改方法》的一些看法。更多内容请查看本栏目更多内容!

本文相关话题: wordpress 回复 评论
版权声明:本文为 安达网络工作室 转载文章,如有侵权请联系我们及时删除。
相关文章
WordPress完成网站投稿者也能够上传图片的办法

本文实例讲述了WordPress完成网站投稿者也能够上传图片的办法。分享给大家供大家参考。详细剖析如下: Word...

应用WordPress发送电子邮件的相干PHP函数用法解析

wp_mail() 函数用来发送邮件,相似于 PHP 的 mail() 函数。 默许的发件人称号是 WordPress,发件人邮箱是相...

wordpress 为主题增加AJAX提交评论性能的php代码

首先需求在主题的function.php文件里增加一段函数: 复制代码代码如下: < ?php function fail($s) { header...

wordpress完成公布文章主动ping 百度

为了放慢收录状况 除了谷歌勤快点 百度也不能落下 复制代码代码如下://文章公布自动ping baidu function pi...

WordPress开发中的get_post_custom()函数应用解析

同get_post_meta()一样,用于前往文章的自定义字段值得一个函数,只不过get_post_custom()函数应用起来更简...

wordpress 主动在注释内容后增加内容

但在制造主题的时分,每个用户的需要都不同,而且你也不可能在文章下方增加太多的内容。因而让用户能自定义...

需求提交

客服服务