WordPress.org

Forums

Editing the comment form (9 posts)

  1. Kiato
    Member
    Posted 3 years ago #

    I've been using WordPress for about a month now and have learned mainly by trial and error. I don't know CSS or html, but that hasn't stopped me from using plugins and tutorials on the net to successfully change the layout of my website. However, there is one simple thing I cannot accomplish: editing the text in the comment form. I have two things I specifically want to do:
    The first is to change the "Your email address will not be published." line in the comment form.
    The second thing is to add a red * symbol after Name and Captch Code in the form. The captch code is handled by a plugin, so I'm not sure if I should change the plugin code or the comment form code to add the symbol. But the Name part is more important to me right now.

    I've looked for a way to do these two things for hours (seriously), but only came up with several unresolved forum questions, resolved questions on older (redundent) versions of WordPress and this page which is very vogue and hard to understand for an html dummy like me. I would highly appreciate it if you could tell me which file to edit for my changes and which lines to add. I'm using a child theme of the standard Twenty Eleven theme. Thank you.

  2. Kiato
    Member
    Posted 3 years ago #

    Anyone? Please?

  3. esmi
    Forum Moderator
    Posted 3 years ago #

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    esmi points you in the right direction, but there is a ton of information on that page. To help narrow it down, you're looking specifically for the comment_notes_before argument, which would be changed as follows:

    $mytheme_comment_form_args = array(
         'comment_notes_before' => 'CUSTOM TEXT GOES HERE'
    );
    comment_form( $mytheme_comment_form_args );

    The second issue involves actually making additional form fields required, which requires a more involved modification. Look at the fields argument.

  5. Kiato
    Member
    Posted 3 years ago #

    Thank you both for your response. As I've written in the original post I've already read that page but it is choke-full of code and does little in the way of explaining it all.
    @Chip: Can you please explain to me where am I supposed to post that argument? Adding it in the end of comments.php didn't change anything and adding it right at the beginning showed that argument line as plain text before the actual form.

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    @Chip: Can you please explain to me where am I supposed to post that argument?

    In comments.php. Replace this:

    <?php comment_form(); ?>

    ...with this:

    <?php
    $mytheme_comment_form_args = array(
         'comment_notes_before' => 'CUSTOM TEXT GOES HERE'
    );
    comment_form( $mytheme_comment_form_args );
    ?>
  7. Kiato
    Member
    Posted 3 years ago #

    It works! Thank you so much. I had such a hard time with that part. About the required fields thing, I simply want the Name field to seem to be mandatory (aka have a * after it) while the email stays optional.

  8. Krishna Veni
    Member
    Posted 2 years ago #

    In comments.php you can edit the comment form follow this steps its worked for me.

    Login in to you Control Panel.
    Open wp-includes folder from File Manager.
    Select comment-template.php and Click Edit
    For more details

    In wordpress 3.0 it is different so follow this method.

  9. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Login in to you Control Panel.
    Open wp-includes folder from File Manager.
    Select comment-template.php and Click Edit
    For more details

    In wordpress 3.0 it is different so follow this method.


    NO NO NO NO NO!

    Do NOT do this. Do not edit core files unless you absolutely know what you're doing.

    And do not advise users to edit core files.

Topic Closed

This topic has been closed to new replies.

About this Topic