简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

如何修改wordpress回复评论文字

来源:易贤网   阅读:1079 次  日期:2014-09-02 15:21:59

温馨提示:易贤网小编为您整理了“如何修改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修改回复文字的方法就这么简单,试试吧。

更多信息请查看IT技术专栏

更多信息请查看CMS教程
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:Z-Blog不同文章显示不同的description描述
下一篇:迁移与合并wordpress网站的过程与心得
易贤网手机网站地址:如何修改wordpress回复评论文字
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
相关阅读      CMS教程