Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Create a child theme based on an existing parent theme in WordPress and change the functionality, presentation, or styling of your website. In this course, author Morten Rand-Hendriksen shows how to use the default WordPress theme, Twenty Twelve, as a basis for a new child theme and add custom menus; new headers, sidebars, and footers; and index pages with widgets and pagination to your site. The course also demonstrates how to add a responsive welcome message to your front page using PHP and jQuery, and how to edit the many templates found in a WordPress theme. Morten explains how to perform these changes using any code editor, the developer tools in the Chrome browser, and WordPress.
A website is a representation of individuality. Whether it be your own or that of your company. One of the many factors that play into putting forward a consistent presence on the web is the use of fonts. In the past, web fonts were fairly restricted. But today thanks to modern browser technology, you have far greater options where fonts are concerned. The Twenty Twelve theme ships with a custom font hosted by Google Web fonts. Later in the course, we will look at how you can swap out this Google font for different Google web font, but for now, let's take a look at how you can change the style sheet in your child theme to use a standard font instead of the one that ships.
Looking at the Twenty Twelve theme, you can see it uses a Sans Serif font, and if we go behind the scenes to look at the style-sheets. So I'll go in here and go Inspect elements, to any elements, and go to Computed Style, you'll see down here under font family, the font that's being used is called Open Sans. It also as a fallback to Helvetica, Arial, and Sans Serif. This is what's called the font family. What happens here is the browser will try to use Open Sans, if Open Sans doesn't work, it'll use Helvetica. If Helvetica doesn't work, it'll use Arial and if Arial doesn't work it'll use any Sans Serif font.
What we want to do is make it change to this font family in such a way that we can use different fonts. To find the original style that kicks in here, instead of using the technique I showed you earlier, I'm simply going to go into the Computed Styles and click on this link that points to the original style in the style-sheet. It's right here. You see body.custom-font-enabled and then you have the font family: Open Sans, Helvetica, Arial, Sans Serif. Directly above it, you'll notice that the body style also has a font family defined.
This is because Twenty Twelve comes with two options, you can use a custom style, custom font enabled, or you can disable the custom font using code and then the original styles will kick in. Right now, we're going to make a change to the body.custom-font-enabled style. So I'll copy that's style out, go in to my child theme, and because this is a body style it should be high up in the hierarchy. So I'm going to paste that in directly under the import call. So here we have the original style the way it was, but now I want to change to font family over completely to another standard font family.
So I'm going to swap out all this code with Georgia, Times New Roman, Times, Serif. When I save the style-sheet now, and reload the web page in my browser, you will see that all the fonts on the entire page have been changed to Georgia because that's now the main font family. Now it's important to note that this doesn't necessarily work the exact same way on all themes. Many themes have very specific fonts assigned to different elements, and you may find that there's several different places where the font is defined.
In which case, you have to go in and find all the places where the font is defined in the original style-sheet and then overwrite it piece by piece, but in a well-written theme the font is defined once at the very top and you can simply overwrite it the way we did just know, by just typing in a new font family. Changing the font family of a website can make a huge difference in how the website appears in what message it communicates to the visitor. Choosing the right font family for your site is important, and no matter what people say, there is no such thing as a right or wrong font.
The font that fits with your message and communicates it well is the right font for your website.
Find answers to the most frequently asked questions about WordPress 3: Building Child Themes.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.