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

Start Your Free Trial Now

Make the site layout responsive Build Wordpress Themes


WordPress: Building Themes from Scratch Using Underscores

with Morten Rand-Hendriksen

Video: Make the site layout responsive Build Wordpress Themes

Making the site layout responsive 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 ...
Making the site layout responsive
Video Duration: 8m 58s6h 23m Advanced Jun 11, 2014

Viewers: in countries Watching now:

Making the site layout responsive 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
Morten Rand-Hendriksen

Making the site layout responsive

As I said in the beginning of this course, as you design and build a WordPress theme, you should always keep in mind that it can be viewed on many different screen sizes. In other words, you need to make sure that your theme is responsive mainly through media queries. Media queries are a type of CSS rules that turn on and off depending on things like, screen width. There are many different schools of thought when it comes to adding media queries to your style sheets. Some like to add them at the top or bottom of the stylesheet, others like to add them as separate style sheets all together.

I personally like to add them as close to the original styles as possible. This means your style sheet will have many media queries in different locations, but it also means it'll be easy to understand what each of the queries do, and what rules they relate to. If we look at our theme right now, you'll see it's kind of responsive when I resize the width of my window here. You'll see that the main content changes shape, and the sidebar stays the same width, which is exactly what I wanted to based on my design.

The problem is when I scale down far enough, you see that the sidebar is taking over all the space, and there's no space for the content. And when people visit your site, they're probably looking for the content and not what's in the sidebar. The reason why this is happening is because I broke my own rule. The rule that I told you in the very beginning of the course was, you should always design and develop for mobile first, and then accommodate for larger screens. But, if we look at the code in our current style sheet, you'll see that we're designing and developing for wide screens.

And then assuming that things would get fixed on smaller screens. So, I went about this the wrong way. What I need to do is take this first rule, the one that allows for space for the sidebar on the right hand side, and wrap it in a media query. So that it only kicks in when the screen is big enough to actually have the sidebar on the right-hand side. But before I can make that rule I need to know when the sidebar is going to kick in. So I need to search for the break point. I'll go back to my browser, and here I'm going to open the developer tools, so I'll hit Ctrl+Shift+i on my Windows computer.

You can also just right-click and inspect element or open it in another way. And when I do this, and I start resizing my window. You'll see up here in the right hand corner I'll have a little display that tells me how wide the window is. So what I need to do now is figure out exactly where I want the breakpoint to happen. So where I want the sidebar to disappear and fall down to the bottom of the page. And if I move this back and forth around this area. You'll see that there's a certain place where the contents starts reshaping, around 1160, 1170.

So I think that it makes most sense to place that break point at 1160 exactly. So that means when the screen is less then 1160 pixels wide. We should only see the main content, and the sidebar should be on the bottom. If the screen is wider than 1160, we should also see the sidebar on the right-hand side. So what I'm going to do is take my content area rule, cut it out, move down to the bottom of my style sheet, paste it back in again, and then I'm going to wrap it in a media query.

So here I'll start by saying @media. Because it's a media query, it targets screens. So I'll say screen, and, and then I'm going to save. This kicks in only when the screen is at 1160 or wider. So I'll say min width 1160 pixels. And then I need to place my rule set inside, then I'll highlight it all and hit tab to move it in. So now, this rule set that allows for space for the sidebar will only appear once the screen is above 1160 pixels wide.

I'll save my layout file and reload my page here, and you'll see that now that we have a small screen. There's no sidebar, and then, pop. The sidebar appears right at 1160, which is exactly what we want. But, if I scroll down, you'll see that on smaller screens, the sidebar looks really weird, because it's still 380 pixels wide, and is still jammed to the right-hand side. So, now that my first media quarry works, I have to also deal with the sidebar.

So I'll go back to my style sheet here. And I'll make another media query, screen and, only this time, I'll say, I want this media query to affect any time before the width of the screen is 1160. So I'll say, max width. So this is up until this width, 1159 pixels. So that means anything before 1160, whatever is in here will kick in. And what we need to do is take the widget area style. So I'll copy it, and I'll paste it in here, and shift it in.

And what we have to do here is make it so that on these smaller screens the width is the full width. So I'll set the width here to auto. I'll also set a max width of 780 pixels, and you'll see why in a second. And then I want to set the float to none. So that it doesn't float to the left or the right. Now I don't actually need to change padding and background because they're already defined in the main style so I'm going to leave that alone, because I don't want to repeat myself. But I am going to add some margin here, so I'll set the margin to top at 1M's and then I'll set left and right to auto, so that the sidebar will float in the middle.

And I'll set the bottom to zero. Now I can save this rule set, and reload my page and you'll see what happens. Now my sidebar has the same width as the main content, and it floats in the middle, as I resize the screen here. And when we get to a wide enough screen, it pops up to the side, and from here it's 380 pixels wide. Now there's two more things I want to do. If you look at the original design, you'll see that the content is floating to the right hand side.

And this is an important design feature in this particular theme because I want the content to always be in the center of the screen, or as close to center as possible. And you'll notice right now that the contents is currently centered within this content space, so it's not centered. So what I want to do is shift the content over to the right hand side, and then when the screen is smaller I want the content to be in the middle. So I'm going to make a small change to one of my rule sets. You'll see that right now this rule set here that covers all of the elements that are within the content, have margin set to auto.

Meaning that it will float in the middle of the container. So what I am going to do is copy out this rule set, and paste it in inside my min-width media query here, so that this kicks in when the screen is wide enough. And then I'm going to remove all the styles except for margin, and here I'll set margin right, to zero. So basically what happens is when the screen is big enough the content will have a margin right of zero, meaning it will jam against the sidebar.

It sounds subtle but check out what happens when I reload the page. Do you see how the content shifted? Well look what happens when I resize the window now. Do you see the content is floating to the right, and sticking to the sidebar, and then, when we get to the break point, it folds in the middle. This is actually an important part of the design. And it's not that apparent when you're working with a small screen like this, but if you were on a much larger screen you would see why this is important. Because, when you're on a much larger screen this sidebar is supposed to stick to the right hand side, and the content is supposed to float in the middle.

So if you go to the code snippets right now. You'll see there's a couple of changes to the media queries. And there's one extra media query that's been added. And those media queries apply to very large screens and what they do is, exactly what I've said. They place the sidebar on the far right hand side, and place the content in the middle. So if you have a larger screen, go grab the extra code snippets, and place them into your file and then, try to resize your window to a much larger screen. And you'll see what I'm talking about with the sidebar floating all the way to the right and the content in the middle.

It's really neat little feature. And it's important because a lot of people have very large screens and you want to utilize the space in as smart a way as possible. And putting the content right in the middle, is one way of doing that. Now that we have the layout we want, it's time to start working on the individual components of our theme.

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

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 to add this course to a playlist

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

Get started

Already a member ?

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.

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.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts. provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now

A trusted source for knowledge.


We provide training to more than 4 million people, and our members tell us that helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

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.