普通网友 2018-08-16 22:06
浏览 85
已采纳

用户可以在我的网站上发布父评论,但无法回复评论(即留下儿童评论)

I'm having an issue on my website.

Users can leave comments on my posts, but nobody can reply to those top level comments. I can reply to comments through the wordpress dashboard, but also cannot do it through the main site itself.

Here is an example: https://themeasureofaplan.com/net-worth-scenario-tool/

If you click the "reply" link underneath any of the comments, nothing happens...

This is a wordpress site, and I built a custom theme by following some tutorials online.

The code in my comments.php file is as follows:

<?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>

Any ideas about how to fix this?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • dongzuan4917 2018-08-16 23:44
    关注

    When you click on add comment you have an error on the console :

    Uncaught ReferenceError: addComment is not defined at HTMLAnchorElement.onclick
    

    So you try on the code to run a function in javascript, and this function is not defined in your javascript code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在ns3中实现路径的自由切换
  • ¥20 SpringBoot+Vue3
  • ¥15 高额悬赏~绕过防火墙被针对了
  • ¥15 IT从业者的调查问卷
  • ¥65 LineageOs-21.0系统编译问题
  • ¥30 关于#c++#的问题,请各位专家解答!
  • ¥15 App的会员连续扣费
  • ¥15 不同数据类型的特征融合应该怎么做
  • ¥15 用proteus软件设计一个基于8086微处理器的简易温度计
  • ¥15 用联想小新14Pro