wordpress回复评论文字的修改方法

所属分类: CMS教程 / WordPress 阅读数: 955
收藏 0 赞 0 分享

  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获取指定分类文章数量的方法,通过自定义函数实现该功能,并总结了几个相应的调用技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

wordpress首页不显示指定分类文章的方法

这篇文章主要为大家介绍了wordpress首页不显示指定分类文章的方法,通过简单的方法即可实现针对特定内容的显示功能,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress禁止特定用户修改密码的方法

这篇文章主要为大家介绍了WordPress禁止特定用户修改密码的方法,涉及针对公共账号权限的修改,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

wordpress主题评论中添加回复的方法

这篇文章主要为大家介绍了wordpress主题评论中添加回复的方法,可以无需通过插件来实现增加评论回复功能,是非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress获取文章内容摘要的方法

这篇文章主要为大家介绍了WordPress获取文章内容摘要的方法,通过较为简单的自定义函数实现这一功能,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress文章标题链接添加正在加载中提示的方法

这篇文章主要为大家介绍了WordPress文章标题链接添加正在加载中提示的方法,可通过添加简单的js脚本实现该功能,是比较实用的技巧,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

wordpress实现读者墙的方法

这篇文章主要为大家介绍了wordpress实现读者墙的方法,涉及数据库调用及相关css布局控制等技巧,是进行WordPress二次开发的典型应用,需要的朋友可以参考下
收藏 0 赞 0 分享

Wordpress实现自带的侧边栏和自定义的侧边栏同时存在的方法

这篇文章主要为大家介绍了Wordpress实现自带的侧边栏和自定义的侧边栏同时存在的方法,是WordPress二次开发中非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

Wordpress页面静态化与静态文件不生成的解决方法

这篇文章主要为大家介绍了Wordpress页面静态化与静态文件不生成的解决方法,涉及针对cos-html-cache 2.7.3插件的使用技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

WordPress实现彩色标签云的方法

这篇文章主要为大家介绍了WordPress实现彩色标签云的方法,涉及针对标签进行修改的技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多