D
D
den-masonov2018-05-16 18:28:36
WordPress
den-masonov, 2018-05-16 18:28:36

The link for replays in wordpress is not displayed. What is the reason?

Using the wp_list_comments() function, I display comments. Defined a callback function to display each comment. And in this function I use comment_reply_link(), but it doesn't output anything. Tried get_comment_reply_link() - also nothing. I tried to substitute the number of the current comment and the page id in the arguments, it did not work. I put 'depth' => 5 into the array of arguments, as advised in Google, but nothing.
The rest of the functions work fine. edit_comment_link and others.
On the WordPress settings page, tree comments are enabled, the nesting level is 5. On the page itself (the comments to which I display), comments are allowed.
Code from the page template where I want to display comments:

<?php get_header(); ?>
<div id="comments" class="comments-area">
            <?php comments_template(); ?>
</div>
<?php get_footer(); ?>

File comment.php
<?php
  $args = array(
    'walker'            => null,
    'style'             => 'ol',
    'callback'          => 'mytheme_comment',
    'end-callback'      => null,
    'type'              => 'all',
    'reply_text'        => 'Reply',
    'page'              => '',
    'per_page'          => '',
    'avatar_size'       => 32,
    'reverse_top_level' => null,
    'reverse_children'  => '',
    'format'            => 'html5', // или xhtml, если HTML5 не поддерживается темой
    'short_ping'        => false,    // С версии 3.6,
    'echo'              => true,     // true или false
  );
?>

<?php if ( have_comments() ) : ?>
  <ol class="commentlist">
    <?php wp_list_comments($args); ?>
  </ol>
<?php endif; ?>


<?php 
function mytheme_comment($comment, $args, $depth) { ?>

  <li id="li-comment-<?php echo $comment->comment_ID ?>" <?php comment_class(); ?>>
    <article id="comment-<?php echo $comment->comment_ID; ?>" class="comment-article">
      <header class="comment-meta">
        <div class="comment-author vcard">
          <cite class="fn"><?php echo $comment->comment_author; ?></cite>
        </div>
        <?php
          $date = $comment->comment_date;
        ?>
        <a href="<?php echo get_Comment_link(); ?>">
          <time datetime="<?php echo date("Y-m-d", strtotime($date)); ?>T<?php echo date("h:m:s", strtotime($date)); ?>">
            <?php echo date("d.m.Y", strtotime($date)); ?>
          </time>
        </a>
        <div class="comment-tools">
          <?php edit_comment_link(); ?>
          <?php comment_reply_link(); ?>
        </div>
      </header>
      <div class="entry-content comment-content">
        <p><?php echo $comment->comment_content; ?></p>
      </div>
    </article>

<?php }
?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question