• Resolved baszer

    (@baszer)


    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 ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter baszer

    (@baszer)

    a part of the answer is here
    https://codex.www.ads-software.com/Function_Reference/comments_template

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

    Thread Starter baszer

    (@baszer)

    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?

    Thread Starter baszer

    (@baszer)

    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' ),
    	));
    	?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom comment template’ is closed to new replies.