• Resolved DJ Allyn

    (@djallyn)


    I really like the Twenty-Eleven theme but for one very tiny irritation that I am trying to solve.

    In the textarea of the comment form, the word “Comment” appears in the box. When you click your cursor in the textara, it goes away. I would like to get rid of that.

    My reason is that I use comment Quicktags, and when that plugin is activated, it shoves that “Comment” out of the textarea and overlaps my quicktag buttons.

    I can’t see where to find that “Comment” reference in the theme. It is obviously a label — is it in the coding of WordPress itself?

    I just want to kill it.

    Any ideas, I am all ears.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Dion Hulse

    (@dd32)

    Meta Developer

    That part of the HTML structure is probably coming from a WordPress template call.
    However, If you use any good html inspector such as Firebug or Dragonfly, you can quite easily see where it’s coming from..

    #respond .comment-form-author label, #respond .comment-form-email label, #respond .comment-form-url label, #respond .comment-form-comment label {
    display: none !important;
    }

    should hide all instances of the label in the comment form.. but that’ll result in no labels at all for the fields, so you’ll probably just want to style it differently.

    It is a label. It’s generated by the comment_form function, but you can override it. Go into Twenty Eleven’s comments.php file (or copy it to your child theme if you’re using a child theme), find the line <?php comment_form(); ?> – it’s at the very bottom.

    Replace it with this:

    <?php comment_form( array(‘comment_field’ => ‘<p class=”comment-form-comment”>’ . ‘<textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea></p>’) ); ?>

    And that’ll remove the label.

    Thread Starter DJ Allyn

    (@djallyn)

    Thanks, Triplanetary, that worked just great!

    hi guys

    i have a question that relates to this, i have the same issue but for some reason the word ‘comment’ appears next to the text box for text entry. you can see it here: https://www.mervingersh.com

    what puzzles me is where is the actual code for the width and height of the actual comments box? i mean honestly, where is it? i have looked through functions.php comments.php and content.php.

    this is a child theme of twenty eleven and i want to style it all from scratch, so i am compiling all my classes accordingly, you can see why i need to know this. i would like to style the comments box to my liking, i know i can just CSS hack it but i want to know where the actual code for the form is for reference.

    thanks.

    Thread Starter DJ Allyn

    (@djallyn)

    @capitalismclown

    Triplanetary answered your entire question above.

    The code comes from the WP code, not your theme code. You can override that code if you go to your comments.php file in your theme and replacing the following:

    <?php comment_form(); ?>

    With this:

    <?php comment_form( array('comment_field' => '<p class="comment-form-comment">' . '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>') ); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twenty-Eleven Question’ is closed to new replies.