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 嵌套回复 (优缺点对照)》的一些看法。更多内容请查看本栏目更多内容!
关于日拜访量还不错的WordPress网站来说,一定都会存在很多待审核的渣滓评论,假如要经过WP后盾删除,那几乎...
1. 自定义用户名和明码 新版本一开端就会给用户惊喜! 目前咱们装置WordPress之后,零碎会给咱们一个用户ad...
很多冤家都在应用Wordpress写集体博客,然而又想把写的博客文章同步到其余的社交网站上,比方人人网,那怎样...
因为集体博客小站的空间与mysql空间往往无限,共享效劳器资源也无限,所以渣滓评论肯定要阻拦在写入数据库之...
同get_post_meta()一样,用于前往文章的自定义字段值得一个函数,只不过get_post_custom()函数应用起来更简...
在wordpress主题中的header.php中,有一个wp_head()函数,外表上看不出什么玄机,只能在阅读器中查看源代码...