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

Start Your Free Trial Now

Customizing and Style index templates Build Wordpress Themes

Customizing and styling index templates provides you with in-depth training on Web. Taught by Morten… Show More

WordPress: Building Themes from Scratch Using Underscores

with Morten Rand-Hendriksen

Video: Customizing and Style index templates Build Wordpress Themes

Customizing and styling index templates provides you with in-depth training on Web. Taught by Morten Rand-Hendriksen as part of the WordPress: Building Themes from Scratch Using Underscores
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 ...
Customizing and styling index templates
Video Duration: 10m 10s 6h 23m Advanced


Customizing and styling index templates provides you with in-depth training on Web. Taught by Morten Rand-Hendriksen as part of the WordPress: Building Themes from Scratch Using Underscores

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

Customizing and styling index templates

Throughout this course, I've been mentioning the dry development principles several times. And now you'll see the value of that approach. If you go to your front page, or to any of the archive pages, you'll see that even though we have yet to touch any of these templates, all the styling for the individual posts that are displayed within the archive pages already inherits all the styling we applied to the same posts in the single post template. So here we have the same typography. And the only thing we need to do for the index pages is change the layout ever so slightly and address issues like Meda content not displaying quite right and removing this content on the bottom in the footer for each post.

If you look back at the design for the index pages, you'll see that the, the display for each post within the index pages is a little bit different from what we had on a single post. First of all, we have that rasterized background and each post is wrapped inside a white box that's separated from the next with some margin. Each post has a smaller feature image at the top, and there's a Continue Reading link at the bottom of each post, you can jump to the next one. In addition, the very first post on the front page displays differently.

It has the full large featured image, and it also displays all the text content before saying Continue Reading. And in this chapter, we're going to look at all of this styling to make our index pages look as good as our single post. So we'll start out by applying the rasterized background and a white box around each post and also generally fixing the mark up for each of the posts on the index pages. So I'm going to open layouts and contents-sidebar and here you'll remember right at the top we have the site-content rule that sets that grey background color.

So here I want to add in that rasterized effect instead, and I'm going to use the same technique I used to add the rasterized effect behind the featured images. So I have that piece of code here in my code snippets. I'm just going to copy out the background declaration and replace just the color. So now we have a background color. And then a transparent SVG that goes on top that adds that rasterized effect. I'll save that and reload it in my browser just to test that it works. And it does. Now we have to wrap each of the individual posts in a white box and align that white box.

To do that, I first need to know where the content is coming from. So I'm going to go do index.php. And find out which template is controlling the actual content. And here if I scrolled down, it will see just like for the single post, we have a loop. In the index.php post, word press first asks are there posts available? And if there are posts, it goes, as long as we've got a post. Go and set the Kern post to the post. So it's basically looping through each of the individual posts one at a time and then displaying its content.

And the ways displaying its content is by using the template part called content. In then, get post format. So if we had different post formats, and apply them to each post, then we'd be able to pull different content templates for each post format. But, if you look at the current list up of content templates that we have, we have content none. Content page, content single and just content. So because we don't have any post formats files for content, we're going to use content.php, we're just a fallback.

Content.php is for amount of varied similarly to contentsingle.php, so here we are going to do the same changes and we're going to do them one at a time. So I'm going to start off by adding that box around each post. And I'm going to add the box inside the article ID, so that the article ID stays the same. So here I'm going to add a new div, with a class, index box. And the index box class is what's going to create the white border. Then I'll close my div at the bottom here, right before the end of the article tag.

And I'll just comment it so I know what it is. And now that I've created the index box class and divider, I need to also add in the styles for it. So I'm going to go back to content sidebar here, and scroll down right before my media queries. And here I'm going to add in the styles. And you can find the styles in the code snippets. So here you see we have, first the index box style, that sets the total width of the box, gives the box padding so that everything gets shifted in and we get nice padding around it. We set a margin on the bottom to 2 m's, to push the content down.

And then we set the background to white. I also have some additional styles to deal with just a block quotes because you'll remember we shifted the block quotes left and right and now I have to make sure that they retain a white background. And also that on larger screens when they are shifted out of the frame, they get padding either on the left or on the right, so that the text doesn't go flush with the edge of the box. So I'm going to copy out all of this, and paste it into my style sheet. Save it. Go back and reload my page. And now each of my individual posts are separated with a nice, white background.

And there's a split between them underneath. But the problem is, right now it's aligning to the middle. And that's because we have to now tell WordPress in the style sheet that we want to use this shifting motion we created previously. So if I go back to content side bar and I scroll down a bit, you'll remember that we have this selector here, entry header, entry content, entry footer, et cetera. And we used it to shift all the content to the right on screens that were between 1160 pixels and 1539 pixels.

So now I'm just going to add index box to this list. And this will apply the same styling and the content will now shift over and become fully responsive. Now that the box is displaying the way that we want, I'm going to add a couple of more changes. First, I'm going to clean up the mark up here. You'll remember on the top on the single post, we said written by themedemos on January 7th, 2012. And then we have the list of comments and also the Edit button. So I'm going to go to content.php and find that same section. And here we have class=entry-meta, my_simone_posted_on.

So here I want to add in the same code that I used, in the single templates. I'm going to go and get content single, find the same section. So here we have my Simone posted on, and I'm going to copy out the rest of the section here and just paste it in, so this would give me that comments link and leave a comment. Then, I also want to add the Edit button right up here. And I know that the Edit button is somewhere within this template. So I'm just going to scroll down until I find it, and it's right here, at the very bottom.

So, I'm going to cut out the Edit button, scroll back up again, and paste it in directly after the comments section. And then when I have all the meta content at the top, I'm going to scroll down and find the footer section and just remove everything that's in the footer section because we don't need any of it for the index template. Later we're going to add that Continue Reading button inside this footer. I'll save this template. Then go and reload my page again, and now you'll see it says written by themedemos, January 7th, 2012.

Leave a comment, and when I scroll to the bottom, we have nothing. So now we have all the formatting we need and there's just one more thing we need to do. Because you notice, the problem of written by themedemos and then no on and no dot after January 7th as returned. And that's because, if we go back to the original style sheet and go to the meta content, this is how we inserted the on and the period. We said, on screens when the max-width is 1319 pixels.

Then we insert on end period. The problem is on the index pages, we want to display this at all times and right now, it's only displaying on smaller screens. So here I'm going to reverse the process. So if you go to the cold snippets one last time, and you go to in style.css and copy out the little section here and replace your media query with that new section, I'll explain what happens. So here I've reversed the process, I've said on every page set post it on before to on, and post it on after to period.

And then, I'm going to find any screen that has the minimum width of 1320, that means any screen that is larger than 1320 that would be when we start shifting the meta content off to the left hand side. I want to take just the single posts and set both posted on before and posted on after to nothing. That way we get the single posts to display the content on the left hand side and this extra content is removed whereas on every single other page including all the index pages we always display it on and period.

So, I'll save that a final time and go and reload my front page. And now you see it says written by themedemos on January 7th, period. Leave a comment. And this happens regardless of what size the screen is. And if I go to the post itself and scroll down, you'll see where we are on the smaller screen, it says written by themedemos on et cetera, but if I scale this up. To a wide enough screen. When the meta content shifts to the right, the on and the period are removed. So now everything works exactly the way we want it. By making some careful changes to the content.php template, copying in elements we've already made, removing other elements, and applying styles, we now have an index template that looks close to the design.

And if you jump to another index, say category or archive, you'll see that our changes are being applied there as well. Dry development principles in action.

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.