• Resolved Spencer24

    (@spencer24)


    Does anyone know where to find the comment_form function so I can edit it. I have searched high and low through the ‘TwentyTen’ theme whos comment.php seems to have taken over from the ‘Default’ themes comments.php

    All I want to do is remove the ‘Website’ field and make the captions for the ‘Name’ and ‘Email’ fields more friendly than the standard one that is built into WP3

    If not is there a way to go back to using the ‘Default’ theme comments.php

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator t-p

    (@t-p)

    I believe it’s in wp-include>>comment-template.php
    around line#1505
    I also wanted to change few things around. But I am not sure if it’s ok to mess with files in wp-include folder!! is it?

    Thread Starter Spencer24

    (@spencer24)

    One way to find out, will let you know how I go on.

    Thanks

    Thread Starter Spencer24

    (@spencer24)

    Thanks t-p

    But my site not using the form in the wp-include>>comment-template.php as the caption for the email address is ‘Your email address will not be published.’ where on my site it says Mail (will not be published).

    Thanks anyway If I sort it I will post the solution here or if someone else comes up with a solution I will confirm it here so you know it works

    You can modify the comment form by passing arguments to the comment_form() function right in the theme. In Twenty Ten, that function is called in the comments.php file. You shouldn’t edit the wp-includes/comment-template.php file.

    To just remove the allowed markup list from below the comment:
    <?php comment_form('comment_notes_after='); ?>

    To just remove the Website field:
    <?php comment_form(array( 'fields' => apply_filters( 'comment_form_default_fields', array('url' => '')))); ?>

    To change the name label to ‘Your Name’, change the email label to ‘Your Email’, change the comment label to ‘Let us know what you have to say:’, and remove the Website field and markup notes:

    <?php $comment_args = array( 'fields' => apply_filters( 'comment_form_default_fields', array(
        'author' => '<p class="comment-form-author">' .
                    '<label for="author">' . __( 'Your 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 -->',
        'email'  => '<p class="comment-form-email">' .
                    '<label for="email">' . __( 'Your 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><!-- #form-section-email .form-section -->',
        'url'    => '' ) ),
        'comment_field' => '<p class="comment-form-comment">' .
                    '<label for="comment">' . __( 'Let us know what you have to say:' ) . '</label>' .
                    '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' .
                    '</p><!-- #form-section-comment .form-section -->',
        'comment_notes_after' => '',
    );
    comment_form($comment_args); ?>

    To get the list above, I copied parts of the $defaults array from the documentation page for the comment_form() function:
    https://codex.www.ads-software.com/Template_Tags/comment_form

    Thread Starter Spencer24

    (@spencer24)

    Thanks for that designsimply it may take me a while, will let you know how I get on.

    thanks again

    Thread Starter Spencer24

    (@spencer24)

    I tried what you said but made no difference so I deleted the comments.php from the twentyten theme and my site still used the default form so I deleted the comment.php from the default theme and it came up with the default form again so I have no idea where it is getting it from

    My site now does not have a comment.php anywhere on the server but I still get the default comment form.

    Moderator t-p

    (@t-p)

    Hi friends,

    @ designsimply

    Where I should place your code (i.e., which file and line #, etc.?)

    Also, say i want to add an additional field and make it required, exactly how can I go about doing it.

    Thanks everybody.

    Hi guys, So, if you are looking at the Twenty Ten theme, then the file is named comments.php. If you are looking at another theme, it may be in a different file. Find out which file has the comment_form call, open that file, and search for “comment_form”. If you have an unmodified version of comments.php from the Twenty Ten theme distributed with WordPress 3.0, then it’s on line 77.

    It looks like this:
    <?php comment_form(); ?>

    Then replace that line with one of the examples from above.

    Moderator t-p

    (@t-p)

    Thnks for your help designsimply,

    If I want to add an additional field and make it required, exactly how can I go about doing it.

    that’s geat advice designsimply….
    do you or anyone else here knows where can i find the comment form so I can give style?

    if you could just give me a hint around what line I can find it if its in the comment-template.php, I’m not really a good with php so I’m haveing trouble identifying the form. And if its not there…. where can I find it?

    I only got the comment box and i want to give it a simple style.

    here’s a link to mi single post section
    https://sitiosbaja.com/demo/box01/

    thanks!

    Is it possible to modify the function that i can place authorname, email and url into one div and commenttext into an other? I′d like to place the commenttext left, the 3 input fields on the right side and assign a different background color to each of these 2 divs.

    Hi folks – I would highly recommend AGAINST changing the core code.

    If you are interested in adding extra fields to the comments form, you could give this plugin a try:

    https://www.solaceten.info/extra-comment-fields-plugin

    Regards
    Sol

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Where to find the comment_form function in WP3’ is closed to new replies.