如何使答复框出现在其注释下方 [英] How to make a reply box appear below its comment

查看:149
本文介绍了如何使答复框出现在其注释下方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个回复框出现在自己的评论下面,而不是在所有评论的结尾。

I'm trying to make a reply box appear below its own comment, instead of at the end of all the comments. For anyone trying to create their own Wordpress comment list, it would be very helpful.

到目前为止,我已经尝试过:

As of now, I have tried:

    <div id="div-comment-<?php comment_ID(); ?>" class="reply">
  <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'add_below' => 'comment-footer', 'max_depth' => $args['max_depth']))) ?>
  <?php delete_comment_link(get_comment_ID()); ?>
</div>
<div id="comment-footer-<?php comment_ID(); ?>" class="comment-footer">
</div>

其中'add_below'=>'comment-footer'会将表单页脚。我不知道为什么这不工作。

Where "'add_below' => 'comment-footer'" would send the form below the specific comment's footer. I don't know why that doesn't work.

推荐答案

想想吧!我需要添加以下 add_below 才能正常工作。

Figured it out! I needed to add the following for add_below to function properly.

将此标题添加到标题: / strong>

Add this to the header:

    <?php
if ( is_singular() && comments_open() && get_option('thread_comments') )
  wp_enqueue_script( 'comment-reply' );
?>

或将其添加到函数

function theme_queue_js(){
if ( (!is_admin()) && is_singular() && comments_open() && get_option('thread_comments') )
wp_enqueue_script( 'comment-reply' );
}
add_action('wp_print_scripts', 'theme_queue_js');

参考

Peter Wilson:包括WordPress的comment-reply.js(正确的方式)

Peter Wilson: Including WordPress’s comment-reply.js (the right way)

这篇关于如何使答复框出现在其注释下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆