我试图使答复框显示在其自己的注释下方,而不是出现在所有注释的末尾。对于任何试图创建自己的Wordpress评论列表的人来说,这将非常有帮助。
到目前为止,我已经尝试过:
<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'”将在特定注释的页脚下方发送表格。我不知道为什么这行不通。
弄清楚了!我需要添加以下内容以add_below
使其正常运行。
将此添加到标题:
<?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(正确的方法)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句