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 嵌套回复 (优缺点对照)》的一些看法。更多内容请查看本栏目更多内容!
获取特定分类文章数 有时分咱们想获取某个分类(category)下的文章数目,以便在博客的某个中央显示进去。上面...
对搜寻引擎暗藏特定的文章 这个成绩的起源是这样的: 家喻户晓,随着搜寻引擎的改进,会越来越排挤采集和伪...
本文实例讲述了WordPress首页显示多个图片及文字友谊链接的办法。分享给大家供大家参考。详细剖析如下: Wo...
comments_template comments_template 函数是一个调用评论模板的函数,应用起来很简略,与get_header()等函...
让WordPress登录页的明码框显示最初一个输出的字符 在通常状况下,网页的设计者们会将明码输出框中的一切字...
通过这次yHtml5主题的制造,我学会了怎样给主题制造言语包,就是普通的汉化主题啦。废话不多说,说步骤。 首...