WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom comment template (4 posts)

  1. baszer
    Member
    Posted 2 years ago #

    Hello,

    With <?php comments_template(); ?> I can get my comments.php into my template.

    But what if I want to change the comment.php for only one page. How can I do this?

    so?

    <?php comments_template(othercomments); ?>

    name comment.php to comment-othercomments.php ?

  2. baszer
    Member
    Posted 2 years ago #

    a part of the answer is here
    http://codex.wordpress.org/Function_Reference/comments_template

    but how can I change the comment form and how the comments are listed?

  3. baszer
    Member
    Posted 2 years ago #

    I am getting closer. I hope somebody can give me final tip!

    I have:

    <?php comment_form( array(
        'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
        'id_form'              => 'commentform',
        'id_submit'            => 'submit',
        'title_reply'          => __( 'Leave a Reply' ),
        'title_reply_to'       => __( 'Leave a Reply to %s' ),
        'cancel_reply_link'    => __( 'Cancel reply' ),
        'label_submit'         => __( 'Post Comment' ),
    )); ?>

    So I can change all the labels of the comment form now. But I lost the input fields (name, email, url). What do I do wrong?

  4. baszer
    Member
    Posted 2 years ago #

    Got it!

    For everybody who has the same problem:

    <?php comment_form( 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>',
    	'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    	            '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
    	'url'    => '',
    	)),
    
     'title_reply'          => __( 'Leave a Reply' ),
        'title_reply_to'       => __( 'Leave a Reply to %s' ),
        'cancel_reply_link'    => __( 'Cancel reply' ),
        'label_submit'         => __( 'Post Comment' ),
    	));
    	?>

Topic Closed

This topic has been closed to new replies.

About this Topic