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 自身以及主题和插件通常需求加载一些 JavaScript 来完成某些非凡性能。为了最大限制地保障兼容性...
最近我心血来潮给博客建一个分类别名为“WordPress”的目录。可是不断提醒“别名已被其它条...
这款插件称号叫Pretty Link Lite,插件主页:http://wordpress.org/extend/plugins/pretty-link/,也能够在...
处理方法: 办法一: 修正文件“/wp-includes/pluggable.php”中的wp_set_auth_cookie函数。搜寻...
你还没决议应用什么软件来构建你的新公司网站吗? 依然以为WordPress只是搭建博客吗? 在互联网上有大约2...
1.增加性能 在function.php中拔出代码 add_theme_support('post-thumbnails'); 拔出之后会在后盾编辑文章的...