• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to add .required span to comment textfield?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to add .required span to comment textfield?

This topic is: not resolved

Tagged: asterisk, comment, comment form, required, text field

  • This topic has 15 replies, 2 voices, and was last updated 10 years, 9 months ago by Brad Dalton.
Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • September 24, 2014 at 6:15 pm #125603
    Escendrix
    Member

    Hello, I am trying to add the .required span to the comment label for the comment form. I understand that the comment form is required (obviously), but it does not have an asterisk which is confusing. I want my design to be coherent, so is there anyway that I can add the asterisk to the comment label to match my other text fields? I would have thought that this would be a default in Genesis.

    Any help is appreciated, thank you.

    September 24, 2014 at 6:43 pm #125604
    Brad Dalton
    Participant

    You can modify the comment form labels using the comment form default fields filter

    Here's more detail http://codex.wordpress.org/Function_Reference/comment_form


    Tutorials for StudioPress Themes.

    September 24, 2014 at 7:02 pm #125607
    Escendrix
    Member

    Thanks Brad!

    I don't know much about php, but I am intermediate with CSS/ HTML. How would I go about making a field required with your code? I see the line that contains the .required span class but they aren't "active" so to speak.

    September 24, 2014 at 7:10 pm #125608
    Brad Dalton
    Participant

    What have you tried so far?


    Tutorials for StudioPress Themes.

    September 24, 2014 at 7:24 pm #125609
    Escendrix
    Member

    Sorry, I guess I should have been more clear that I don't know PHP at all 😛 , so technically speaking I haven't done anything besides searching on Google to no avail.

    September 24, 2014 at 7:40 pm #125611
    Brad Dalton
    Participant

    You could add an asterisk using this code http://wpsites.net/web-design/customize-comment-field-text-area-label/

    I suggest you install WordPress locally or use a test site to test code modifications if you want to make the changes to your theme yourself.


    Tutorials for StudioPress Themes.

    September 25, 2014 at 12:43 am #125632
    Escendrix
    Member

    Hmm it seems like that tutorial is more about styling the look and text of the comment field; I couldn't find anything about making a field required. I've already styled my forms and made them how I want, I just wanted to add that .required span to the comment text area so that it would have an asterick like my other required text fields. I understand that you can't submit a form without a comment, so it seems very strange that Genesis doesn't add the required class to the comment text area by default.

    I could easily change the label to have one by default without using the class, but for learning purposes I want to figure out how to add the actual span class if possible.

    I am developing my WordPress site locally with Wamp server so there's no problem there.

    September 25, 2014 at 12:46 am #125633
    Brad Dalton
    Participant

    Why can't you add it to the label?


    Tutorials for StudioPress Themes.

    September 25, 2014 at 12:47 am #125634
    Escendrix
    Member

    Now that I think about it, I guess the bigger question to ask is how to go about changing the default comment form to use a plugin's comment form, such as Ninja Forms, but maybe that should be for another topic. Maybe the long-term solution is to learn PHP and code my own form structure, but that's not an option at this point. I'm trying to get my website up quickly and I've pretty much finished the custom style sheet already. I don't want to delay the development by learning a new language, although I want to at some point.

    September 25, 2014 at 12:48 am #125635
    Escendrix
    Member

    I could do that, but I was trying to figure out how to add the .required class instead.

    September 25, 2014 at 1:30 am #125636
    Escendrix
    Member

    I actually found this: https://core.trac.wordpress.org/ticket/16206 but I'm not sure if making modifications directly to WordPress would be a good idea and I'm not sure how to go about implementing that through my child theme's functions.php file.

    September 25, 2014 at 1:39 am #125637
    Brad Dalton
    Participant

    The code i linked to enables you to change the text label so you can also add an asterisk.

    Please mark this as resolved and ask a new question if needed.


    Tutorials for StudioPress Themes.

    September 25, 2014 at 1:45 am #125638
    Escendrix
    Member

    Maybe I'm not being more clear, if so I apologize.

    As I've said before, I completely understand that I can modify the label to add an asterisk, but that's not what my original question was about. To me, that's more of a "hack".

    The reason I opened this topic was to find out why WordPress does not add the .required span to the comment text area, and how I could go about adding it. I don't want to modify the label, I want to add the .required span that are used for the name and email text fields.

    I hope I have made myself more clear for you, sorry for any confusion.

    September 25, 2014 at 2:36 am #125640
    Brad Dalton
    Participant

    I think its already included which you can see if you look at the code. The only thing which isn't is the *


    Tutorials for StudioPress Themes.

    September 25, 2014 at 3:16 am #125641
    Escendrix
    Member

    If the code is there, then why are they not showing up? There is a comment at the very bottom by "Hassan" that is having the same problem as me.

    Furthermore, your tutorial and code was specifically for name, email, and website text fields, but I want the class to be added to the comment box as well.

    September 25, 2014 at 3:35 am #125643
    Brad Dalton
    Participant

    In my code i saw it. In the second tutorial i linked to.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 16 posts - 1 through 16 (of 16 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble