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-">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修改回复文字的方法就这么简单,试试吧。
您可能感兴趣的文章
- 11-11wordpress导航菜单新窗口打开的设置方法
- 11-11WP-PostViews插件如何修改文章阅读数
- 11-11wordpress附件保存目录改为年月日和上传文件重命名为时间戳
- 11-11WordPress 上传媒体库文件重命名 全格式支持
- 11-11解决wordpress安装后更新或者上传文件权限不足的问题
- 11-11wordpress实现主动推送+熊掌号推送同步进行
- 11-11WordPress 添加友情链接设置 nofollow 属性
- 11-11WordPress 实现 wp_list_bookmarks 自定义友情链接排除调用
- 11-11WordPress首页指定或排除某分类文章显示
- 11-11WordPress不同分类调用不同的文章模板


阅读排行
推荐教程
- 09-22wordpress如何添加描述
- 11-11wordpress附件保存目录改为年月日和上传文件重命名为时间戳
- 10-19纯代码给WordPress网站添加独立下载页面功能
- 11-11WordPress之给文章内容中间插入广告的实现方法
- 10-18wordpress无插件调用随机文章的方法
- 10-18WordPress 技巧:WordPress 后台也使用七牛云存储
- 10-24Win10无法调节声音怎么办?Win10无法调节声音的解决方法
- 10-19WordPress上传图片HTTP错误的解决方法
- 10-18让注册用户可以上传自己的头像的WordPress插件-WP User Avatar v2.
- 11-11国外WordPress精美主题如何DIY汉化成中文版呢?





