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修改回复文字的方法就这么简单。
(资源库 www.zyku.net)
栏 目:WordPress
下一篇:WordPress 文章/页面添加时间限制,到期后自动重定向到指定网址
本文标题:WordPress回复评论文字的修改方法
本文地址:https://www.zyku.net/wp/666.html
您可能感兴趣的文章
- 03-18帝国CMS关闭评论验证码
- 03-16帝国CMS在内容页面直接显示评论
- 03-16帝国CMS内容页评论显示会员头像
- 05-07wordpress如何修改后台登录地址,提高安全性
- 11-29WordPress提示正在执行例行维护,请一分钟后回来的解决
- 05-16Wordpress网易云跟贴插件安装教程
- 03-15wordpress网站改版不得不看的六个方面
- 03-15WordPress占用资源过大 一般的优化方法
- 03-15Wordpress对比PageAdmin、织梦和帝国
- 03-15PHP7.0正式版 VS PHP5.5.30 WORDPRESS性能测试对比
- 02-11pytorch固定BN层参数的操作
- 12-25智汀智能-智汀智能应用软件功能介绍
- 03-31Django migrate报错的解决方案
- 03-18oppoa95拨号声音关闭方法
- 12-25小学语文同步详解-小学语文同步详解应
- 11-21帝国CMS列表内容模板(list.var) 调用
- 01-11鸿铭阅读-鸿铭阅读应用软件功能介绍
- 01-12Kids Fitness-Kids Fitness应用软件功
- 03-21一加9查看农历方法
- 09-27nomo相机白色边框怎么去除
最近更新
阅读排行
猜你喜欢
- 01-28红米note9pro状态栏启用电量百分比样
- 05-10javascript实现单张或多张图片持续无
- 01-25python scipy.misc.imsave()函数的用
- 01-12掌上画画-掌上画画应用软件功能介绍
- 02-20Notepad++如何关联文本
- 03-05opporeno6取消指纹解锁振动方法
- 12-26phpyun人才网-phpyun人才网应用软件功
- 04-07vivos9手机关闭快应用的方法
- 03-01苹果12开启辅助触控方法
- 01-12归来漫画-归来漫画应用软件功能介绍