我正在用AJAX加载评论。除了页面上没有呈现回复链接外,一切正常。据我所知,问题是无法传递$args。如何访问回调之外的$args或max\\u depth?
Ajax模板:
<?php
require_once( $_SERVER[\'DOCUMENT_ROOT\'] . \'/wp-load.php\' );
if (isset($_POST[\'id\']) && $_POST[\'id\']) {
$comments = get_comments(array(\'post_id\' => $_POST[\'id\']));
foreach ($comments as $comment) {
$GLOBALS[\'comment\'] = $comment;
?>
<div class="comment">
<?php comment_text(); ?>
<div class="comment__reply">
<?php
comment_reply_link (
array_merge(
$args,
array(
\'reply_text\' => __( \'Répondre \', \'autourdesanimaux\' ),
\'depth\' => $depth,
\'max_depth\' => get_option( \'thread_comments_depth\' )
)
)
);
?>
</div>
</div>
<?php }
} ?>
此代码无法识别(我使用的是自定义ajax)
array_merge(
$args,
array(
\'reply_text\' => __( \'Répondre \', \'autourdesanimaux\' ),
\'depth\' => $depth,
\'max_depth\' => get_option( \'thread_comments_depth\' )
)
)
谢谢你
这篇文章没有解释如何访问$argsLoad custom formatted comment with AJAX: reply link isn’t rendered?