2. 嵌套回复有针对性的回复性能 (针对某条评论进行回复) 是它的劣势, 同时也是他的优势. 假如有 100 集体在你的一篇文章中宣布了评论, 并且你习气对大局部评论都进行回复, 那是不是你也需求回复差不多 100 次? 假如这样的话, @ 回复比嵌套回复更适宜你.
3. 嵌套回复依赖阅读器对 JavaScript 的支持.
我不应用嵌套回复也是由于前两个缘由, 我不敢确定本人当前会不断应用嵌套回复, 并且在我的回复者中, 常常呈现几集体发问同一个成绩. 应用 @reply 是一个折中的抉择, 我能够在一个回复中答复网友的评论, 并且我无需对相反的发问进行屡次答复; 另外, 经过一些插件, 我同样能够完成回复邮件告诉的性能, 仅是邮件内容稍为复杂罢了.
在主题中完成嵌套回复的办法有二, 包括 WordPress 提供的默许办法和自定义的回调办法. 上面我会解说一下如何完成起嵌套构造, CSS 局部请自行钻研.
默许办法:
WordPress 提供的根本的嵌套格调, default 主题用的就是这种模式.
优点: 不便应用, 缩小代码量.
缺陷: 代码构造不好, 不可能适宜一切的主题.
完成步骤如下:
1. 在 header.php 的 <?php wp_head(); ?> 后方增加以下代码.
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> <SPAN style="COLOR: #b1b100">if</SPAN><SPAN style="COLOR: #009900">(</SPAN>is_singular<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #009900">)</SPAN> wp_enqueue_script<SPAN style="COLOR: #009900">(</SPAN> <SPAN style="COLOR: #0000ff">'comment-reply'</SPAN> <SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN>
<SPAN style="COLOR: #b1b100">if</SPAN> <SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #339933">!</SPAN><SPAN style="COLOR: #990000">empty</SPAN><SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #000088">$_SERVER</SPAN><SPAN style="COLOR: #009900">[</SPAN><SPAN style="COLOR: #0000ff">'SCRIPT_FILENAME'</SPAN><SPAN style="COLOR: #009900">]</SPAN><SPAN style="COLOR: #009900">)</SPAN> <SPAN style="COLOR: #339933">&&</SPAN> <SPAN style="COLOR: #0000ff">'comments.php'</SPAN> <SPAN style="COLOR: #339933">==</SPAN> <SPAN style="COLOR: #990000">basename</SPAN><SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #000088">$_SERVER</SPAN><SPAN style="COLOR: #009900">[</SPAN><SPAN style="COLOR: #0000ff">'SCRIPT_FILENAME'</SPAN><SPAN style="COLOR: #009900">]</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #009900">)</SPAN> <SPAN style="COLOR: #009900">{</SPAN>
<SPAN style="COLOR: #990000">die</SPAN> <SPAN style="COLOR: #009900">(</SPAN>__<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #0000ff">'Please do not load this page directly. Thanks!'</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN>
<SPAN style="COLOR: #009900">}</SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> wp_list_comments<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> comment_id_fields<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> cancel_comment_reply_link<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> comments_template<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<?php comments_template(); ?>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> comments_template<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #0000ff">''</SPAN><SPAN style="COLOR: #339933">,</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #009900">true</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<?php comments_template('', true); ?>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> wp_list_comments<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<?php wp_list_comments(); ?>
<SPAN style="FONT-WEIGHT: bold; COLOR: #000000"><?php</SPAN> wp_list_comments<SPAN style="COLOR: #009900">(</SPAN><SPAN style="COLOR: #0000ff">'callback=custom_comments'</SPAN><SPAN style="COLOR: #009900">)</SPAN><SPAN style="COLOR: #339933">;</SPAN> <SPAN style="FONT-WEIGHT: bold; COLOR: #000000">?></SPAN>
<?php wp_list_comments('callback=custom_comments'); ?>
以上就是安达网络工作室关于《WordPress 嵌套回复 (优缺点对照)》的一些看法。更多内容请查看本栏目更多内容!
复制代码代码如下:<title><?php if ( is_home() ) { ?><?php bloginfo('name'); ?> | <?php bloginfo('...
成果: 将上面的函数放到你的主题的 functions.php 文件中: 代码如下: function theme_echo_pagenavi(){ gl...
首先,在主题functions.php中添加上面的代码: 复制代码代码如下:function wp_dashboard_GongGao() { if...
本文实例讲述了WordPress完成的首页幻灯片展现性能。分享给大家供大家参考,详细如下: 关于WordPress拓展性...
最近对wordpress的一些小改良很感兴味,能够让你的博客愈加共性,也更风趣味性,上面的代码能够在后果中高亮...
最近明月给博客和主站都部署了SSL证书,彻彻底底的退出了HTTPS站点行列。这个时期也用到了SQL查问语句来批量...