Watch every course in the library with a membership.
Each course includes high-quality videos taught by expert instructors.

Start Your Free Trial Now

Style the comment form and messages Build Wordpress Themes

The comment form is the box where users can leave comments. You can change the way this form appears… Show More

WordPress: Building Themes from Scratch Using Underscores

with Morten Rand-Hendriksen

Video: Style the comment form and messages Build Wordpress Themes

The comment form is the box where users can leave comments. You can change the way this form appears to both logged in and anonymous users if you want to further customize your WordPress theme. Learn how to style the comment form and messages when you build WordPress themes by watching this video tutorial.
Expand all | Collapse all
  1. 10m 55s
    1. Welcome
      1m 4s
    2. What to know before you start this course
      2m 40s
    3. How this course and the lesson files work
      3m 12s
    4. Introducing Simone: A preview of the final project
      3m 59s
  2. 21m 28s
    1. Installing and running WordPress on your computer
      3m 53s
    2. Getting and installing Underscores
      4m 11s
    3. Installing WordPress Theme Unit Test data
      4m 18s
    4. Installing the Developer plugin
      2m 58s
    5. Installing and setting up NetBeans or another IDE
      6m 8s
  3. 16m 15s
    1. Designing for mobile, content, and style
      4m 52s
    2. How do WordPress themes work?
      4m 48s
    3. Understanding the WordPress template hierarchy
      2m 19s
    4. Underscores: An overview
      4m 16s
  4. 37m 5s
    1. Setting up style.css
      4m 47s
    2. Configuring baseline settings and functions
      6m 6s
    3. Enabling custom fonts and font icons
      5m 44s
    4. Applying global styles
      5m 11s
    5. Styling basic layout components
      6m 19s
    6. Making the site layout responsive
      8m 58s
  5. 23m 18s
    1. Styling the default header
      6m 25s
    2. Hiding the site title and tagline
      5m 32s
    3. Adding an optional header image function
      5m 23s
    4. Placing the header image behind the site title
      5m 58s
  6. 40m 55s
    1. Setting up menus
      3m 12s
    2. Styling the menu
      7m 42s
    3. Using Superfish for accessible menus
      8m 0s
    4. Making the menu responsive
      7m 3s
    5. Creating a custom social media menu
      5m 51s
    6. Styling the menu with icons from Font Awesome
      9m 7s
  7. 18m 9s
    1. Adding the search form
      6m 27s
    2. Adding the search icon
      6m 55s
    3. Adding show/hide functionality to the search form with jQuery
      4m 47s
  8. 33m 20s
    1. Adding a widgetized area to the footer
      7m 10s
    2. Using the Monster widget plugin to test all widgets
      2m 11s
    3. Styling the footer
      3m 6s
    4. General widget styling
      5m 33s
    5. Adding custom styles to specific widgets
      7m 34s
    6. Using Masonry to make footer widgets responsive
      7m 46s
  9. 54m 49s
    1. Changing the Single Post Template content structure
      5m 54s
    2. Changing the output of meta elements
      7m 2s
    3. Styling the Single Post Template
      7m 57s
    4. Making post meta responsive
      6m 21s
    5. Styling blockquotes
      5m 39s
    6. Creating pull quotes and pull images
      5m 1s
    7. Working with image captions
      4m 27s
    8. Working with image galleries
      4m 57s
    9. Single-post navigation
      7m 31s
  10. 30m 23s
    1. Working with the comments template
      8m 42s
    2. Using Gravatars in comments
      2m 42s
    3. Styling comments
      7m 26s
    4. Highlighting post author comments
      3m 36s
    5. Styling the comment form and messages
      7m 57s
  11. 18m 43s
    1. How do featured images (post thumbnails) work?
      2m 57s
    2. Defining featured image sizes
      3m 30s
    3. Generating new featured images with a plugin
      1m 46s
    4. Adding featured images to a template
      5m 7s
    5. Styling the featured image
      5m 23s
  12. 1h 2m
    1. The index template hierarchy
      2m 21s
    2. Customizing and styling index templates
      10m 10s
    3. Displaying excerpts or full content on index pages
      3m 6s
    4. Adding a custom Read More link
      3m 48s
    5. Adding featured images
      4m 0s
    6. Creating custom pagination navigation
      6m 4s
    7. Highlighting Sticky Posts
      2m 55s
    8. Creating custom post format templates
      5m 30s
    9. Highlighting the most recent post in the index template
      7m 22s
    10. Embracing modular design
      2m 29s
    11. Working with archive.php
      5m 54s
    12. Customizing the search results and the 404 template
      8m 28s
  13. 9m 7s
    1. Styling pages
      3m 4s
    2. Creating custom page templates
      6m 3s
  14. 4m 30s
    1. Adding editor styles to match front-end styles
      4m 30s
  15. 2m 20s
    1. Further learning
      2m 20s

please wait ...
Styling the comment form and messages
Video Duration: 7m 57s 6h 23m Advanced


The comment form is the box where users can leave comments. You can change the way this form appears to both logged in and anonymous users if you want to further customize your WordPress theme. Learn how to style the comment form and messages when you build WordPress themes by watching this video tutorial.

View Course Description

Ready for your next WordPress challenge? Learn how to build more complex custom themes using the _s (aka Underscores) starter theme. Morten Rand-Hendriksen takes you from basic layout and customization to enabling advanced responsive design and accessibility features. He reinforces the basics lessons with DRY (don't repeat yourself) development practices and a structured approach that will help you build WordPress themes that meet modern standards. Plus, he'll explore core concepts like understanding the WordPress template hierarchy, creating functions, adding custom JavaScript, applying styles, and more.

Topics include:
  • Installing WordPress, Underscores, plugins, and NetBeans
  • Designing for mobile, content, and style
  • Setting up the basic theme
  • Building a custom header
  • Designing responsive, accessible menus
  • Adding a custom search form
  • Using and styling widgets
  • Adjusting the Single Post Template
  • Working with comments, featured images, index templates, and static pages
  • Adding editor styles to match front-end styles
WordPress underscores

Styling the comment form and messages

With the comments themselves styled, so they appear as they do in my designs, it's time to focus on the comment form, that you find on the bottom of the comments section. When you work with a comment form, you have to consider that there's actually two comment form versions. You have the one you see right now, which is the one you see when you're logged in, so that would be for you. And your authors and possibly some of your users if you allow them to register to your site. And then you have the public forum which asks the user to input their name, their email address, and their website before they can leave a comment.

And you have to apply styles to both of these forms. So the trick here is to apply styles to the public forum because the private one, the one you see here, the logged in one will automatically inherit the same styles. To get to that public forum, I'm going to copy out the URL, right now. And then hit Ctrl+Shift+N in my Windows computer or Cmd+Shift+N and this will open an incognito window. In Chrome you see the little spy up in the corner here. And then I'll paste in my URL here.

and the reason why I do that is because now, I'm not logged in this incognito window. But I'm logged in in my previous window, so I can switch back and forth between the logged in state and not logged in state and make sure that everything looks right in both situations. Looking back at my design you see here I have some very basic design for my comment form. I have a nice large title for the comment form. Then I have each of the labels for the form items, displaying above the form items. And then I just have simple borders around each of the form fields.

And when you look at the common form out of the box from underscores, you see that we already have the borders, and we have all the elements we need. So, we just need to apply styles to change them. To here, I'm going to do exactly what I did previously. I'll target the classes for each of the elements and just work my way down, from top to bottom. So, I'll start with the title. And, if I look at the title, you'll see it has the class comment-reply-title. So here I can go to the code-snippets for this movie, and you see I start off with a class called common-reply-title.

I'll go into my style.css file and find my comments section, and here I'll scroll all the way to the bottom of the comment section below the responsive section, because the comments form appears below all the comments. And here I'll first paste in my rule for, comments-reply-title. And you can see I'm just setting the font-weight and the font-size, and setting a little but if a margin on the bottom, to separate it from the rest of the contents. I'll save that. And reload in my incognito browser. And now we have a nice big title.

The next thing I want to do is make sure all the font, within my comments form, is set to Lato, so I have Lato here, I have Lato for the labels, I have Lato inside the each of the form elements. But, I want to set the font face for the actual comment itself to PT Serif because this is going to be real content. So here I have the two rules that set that. I target all of comment-form and set the font-family to Lato. And then I target just a comment-form textarea, which is the main comment area, and then I set the font here to PT Serif.

You'll also notice I changed the font sizes, so I have very large font in both of these areas, so I'll copy out these two rules. And paste them in below the title, and reload my incognito window. And now you see we have the Lato font face, it's smaller than it was before, and inside the regular fields we have Lato font face, and inside the comment field we have PT Serif. Now I need t reconfigure the overall design because in my design I want the labels for each of the comment fields to appear above the comment field.

But right now they appear to the left. So, I'm going to set the labels within the comment section to be block elements. That way, they'll take up an entire line and bump the fields down. At the same time, I want to make this asterisk, that indicates that this field is required, red. So, if I look at the markup, here you'll see that, within the author label, I have the word name. And then, I have a span, with a class required. And, that's the span that contains the asterisk. So, if I target the class required, I can set required to red and then the asterisk will be red.

So here I have comment-form label and display it as block and then I have class required color red. Copy that out, paste it in, and reload and now my labels display above the form fields and my asterisk is red. And here you notice one of those design in the browser things. In my original design, I had my form fields span across the entire screen. But now that I look at this design with the form fields are smaller, I realize this actually works better because you're not going to have a name that's long enough to fit the entire screen here, and you're not going to have an email address or a website that fits the entire screen.

So, it's actually better to have a smaller field for these. Now my public forum is fully styled. And I should check back with my logged in form just to make sure that I'm inheriting the same styles. And here you see I am. So now I just need to check one more thing, and that is to make sure any warning that appears, when people leave a comment is actually displayed properly. Because, if I go into my settings here and go to Settings and Discussion. I can change the moderation of my comments, so that every comment must be manually approved.

That way when someone leaves a comment the comment will be held for moderation until you say it is. And when that happens they'll get a warning saying, hey, your comment is being held for moderation. So now I'm going to go back to my incognito window and put in a fake name, Fake Name at, put a Website, and a Comment. Here is a comment that will be held for moderation.

And, I'll post this comment. Now the comment will be posted, but the only person who can see it is the person who left the comment, and as that poster I can see the warning which says your comment is awaiting moderation. If I inspect this element you'll see it's wrapped in a class that says comment awaiting moderation. And here you have to remember, when a comment is held for moderation there's a good chance that the person who left the comment will be annoyed. So, when you style this warning you want it to be as friendly as possible.

So what I like to do is wrap it in a green background, so that even though it's a warning, it's not red and blaring, it's green, saying hey, this is a friendly reminder that your comment is awaiting moderation. But I'll probably approve it very soon. So the final rule, I'm going to apply is this one, comment awaiting moderations, copy it out. And paste it into my style sheet. And when you look at it, you'll see here I set the font-family to Lato, because this is a message from WordPress. I set a nice large font-size. I set the font-color to white and the background to a greener color, and then I give the box some padding, and some margin, so that it is nicely separated from the rest of the content.

So, now I'll save that, go back to my incognito browser and reload the page one last time. And you'll see now the warning, your comment is awaiting moderation, is a nice friendly warning that is not going to stress the person who left the comment out, but it's still telling them that something is off. And there you have it. Now we have a fully styled comments section, both the comments themselves, and the comments form. And you know how to work with the comments section within the WordPress site, so if you want to add additional elements or you want to change something in my design, or you want to add your own flair to the styles, you can do so from your style sheet or from the comments.php template.

There are currently no FAQs about WordPress: Building Themes from Scratch Using Underscores.






Don't show this message again
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed WordPress: Building Themes from Scratch Using Underscores.

Return to your organization's learning portal to continue training, or close this page.


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a Member and Create Custom Playlists

Join today and get unlimited access to the entire library of online learning video courses—and create as many playlists as you like.

Get started

Already a member?

Log in

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

You started this assessment previously and didn’t complete it.

You can pick up where you left off, or start over.

Resume Start over

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.