php - 用户可以在我的网站上发布家长评论,但不能回复评论(即留下子评论)
问题描述
我的网站有问题。
用户可以对我的帖子发表评论,但没有人可以回复那些顶级评论。我可以通过 wordpress 仪表板回复评论,但也不能通过主站点本身来回复。
这是一个示例:https ://themeasureofaplan.com/net-worth-scenario-tool/
如果您单击任何评论下方的“回复”链接,则没有任何反应...
这是一个 wordpress 网站,我根据一些在线教程构建了一个自定义主题。
我的comments.php文件中的代码如下:
<?php
/**
*
* Comments themplate - Adapted Version of Kubrick's
*
* There are 2 distinct sections after the protection area ::
* Display Comments is a loop surrounding the wp_list_comments() function
* The Form/Login section uses comment_form() to do everything
* ( Finally the RSS link is at the end of the page )
*
* */
// ########## Do not delete these lines
if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
die ('Please do not load this page directly. Thanks!'); }
if ( post_password_required() ) { ?>
<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.', 'kubrick'); ?></p>
<?php
return; }
// ########## End do not delete section
// Display Comments Section
?> <div class="comment-section-area">
<?php echo "<h2 class='comment-intro-header'>Comment Section</h2>";
if ( have_comments() ) : ?>
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses');?> <?php printf('to “%s”', the_title('', '', false)); ?></h3>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<ol class="commentlist">
<?php
wp_list_comments(array(
// see http://codex.wordpress.org/Function_Reference/wp_list_comments
'login_text' => 'Login to reply',
'callback' => null,
'end-callback' => null,
'type' => 'all',
'avatar_size' => 32,
'reverse_top_level' => null,
'reverse_children' => null
));
?>
</ol>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<?php
if ( ! comments_open() ) : // There are comments but comments are now closed
echo"<p class='nocomments'>Comments are closed.</p>";
endif;
else : // I.E. There are no Comments
if ( comments_open() ) : // Comments are open, but there are none yet
echo"<p class='no-comment-open-section'>Be the first to write a comment.</p>";
else : // comments are closed
echo"<p class='no-comment-closed-section'>Comments are closed.</p>";
endif;
endif;
// Display Form/Login info Section
// the comment_form() function handles this and can be used without any paramaters simply as "comment_form()"
comment_form(array(
// see codex http://codex.wordpress.org/Function_Reference/comment_form for default values
// tutorial here http://blogaliving.com/wordpress-adding-comment_form-theme/
'comment_field' => '<p><textarea name="comment" id="comment" cols="45" rows="10" tabindex="4" aria-required="true"></textarea></p>',
'label_submit' => 'Submit Comment',
'comment_notes_after' => ''
));
// RSS comments link
echo '<div class="comments_rss">';
comments_rss_link('Comments RSS Feed');
echo '</div>';
?> </div>
关于如何解决这个问题的任何想法?
提前致谢!
解决方案
当您单击添加评论时,控制台上会出现错误:
Uncaught ReferenceError: addComment is not defined at HTMLAnchorElement.onclick
因此,您尝试在代码中运行 javascript 中的函数,并且该函数未在您的 javascript 代码中定义。
推荐阅读
- curl - 使用客户端api时如何在akka http httpRequest中添加多个参数
- python - Django中的熊猫关联
- java - java spring-boot错误:“无法解析符号jdbc”
- python - openCV python没有读取我的图像,路径不存在
- node.js - 如何设置测试套件以对与模拟器(尤其是 Firestore 模拟器)连接的 Firebase 功能进行单元测试?
- clojure - 从一维创建二维向量
- github - 哪些私有仓库有 GitHub Pages
- java - 如何修复 MAC OS 的 javafx 中的非 qwerty 键盘布局错误
- jenkins - 是否可以使用 GraphListener 检测运行 Jenkins 管道的阶段故障?
- c - 如何在C中打印所有十进制数字,直到所需的最后一位?