Actual comments not showing, but form is?

I have edited the comments form to remove a few fields and now the approved comments don't show up, just the form itself.

What am I missing from this?

?php
$comment_args = array(
    'fields' = apply_filters(
        'comment_form_default_fields', array(
            'author' = 'p class="comment-form-author"' .
                'label for="author"' . __( 'Name_' ) . '/label ' .
                ( $req ? 'span class="required"*/span' : '' ) .
                'input id="author" name="author" type="text" value="' .
                esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /' .
                '/p!-- #form-section-author .form-section --',
            'url'    = ''
        )
    ),
    'comment_field' = 'p class="comment-form-comment"' .
        'label for="comment"' . __( '' ) . '/label' .
        'textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"/textarea' .
        '/p!-- #form-section-comment .form-section --',
    'comment_notes_after' = '',
    'title_reply' = 'Leave a Comment',
     'comment_notes_before' = '',
);
comment_form( $comment_args );
?

No sign of the commentslist? Even adding wp_list_comments doesn’t work.

Anyone able to help, many thanks?

Topic comment-form comments Wordpress

Category Web


You could try get_comments(); Add it right underneath comment_form($comment_args);


Your format looks a bit off to me. I'd try it more like this:

<?php $fields = array(
                      'author' => '<p><label for="author"><span class="req">* </span>' . __( 'Name' ) . '</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
                      'email'  => '<p><label for="email"><span class="req">* </span>' . __( 'Email' ) . '</label><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
                      'url'    => '',
                     );
      $theme_defaults = array(
                              'comment_field' => '<p class="comment-form-comment">' . '<label for="comment">' . __( '' ) . '</label>' . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' . '</p><!-- #form-section-comment .form-section -->',
                              'comment_notes_after' => '',
                              'title_reply' => 'Leave a Comment',
                              'comment_notes_before' => '',
                             );

comment_form( $comment_args ); ?>

Source: WordPress Codex

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.