Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

You could try get_comments(); put it right underneath comment_form($comment_args); http://codex.wordpress.org/Function_Reference/get_comments#Usage

share|improve this answer
    
No that doesn't work :( –  user4630 Oct 30 '12 at 10:49
add comment

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

share|improve this answer
    
Thanks Shelly but that doesnt work either :( No comments list. –  user4630 Oct 30 '12 at 14:19
    
Are you only showing us part of your file? I'm thinking maybe the issue is elsewhere then. I know for a fact the above works (with commentlist) after it) because it's my default for most of the sites I create. Have you checked your error logs to see if there's an error co,ing up that you aren't seeing? –  Shelly Oct 30 '12 at 17:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.