Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
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.
Before we dive deeper into the world of WordPress themes, it's important that you have an understanding of how WordPress operates and how the different pages of your website are created. WordPress is a web application that interacts with a database. That means the constant you enter when you create a new post or a new page doesn't live in the website itself. The content lives in a database and it's only displayed using templates when the visitor asks for that content. A theme is a collection of templates WordPress uses to display the database content.
Because of the structure, the database contains to content and the theme decides how that content is going to be displayed on the website. When you change your theme, you're changing the way the content is displayed without changing the content in the process. Now when I say template, it's a bit of misnomer because a theme in WordPress doesn't work with one file per type of content. Instead, any page you see when you access a WordPress site, you are actually seeing multiple different template files combined together to create one page.
For instance, if you were to look at an index page, like the front of a blog, you would usually see a header created by the header.php template, you would see the content created by index.php, you would see a sidebar created by sidebar.php and the footer created by footer.php. But if you were to look at a single page, we would still see the same header, the same sidebar and the same footer but the content would be created by a single.php instead. So how do you know which of these template files kick-in at what point? That's where the WordPress template hierarchy comes in.
At any one time, when there's a person asking for specific content from the database, by clicking a link inside your site, the database and the browser interact to figure out what type of content this is and then use the appropriate template file to display that content. The database in the browser basically goes through the schematic to figure out which template to use. Let's say you're accessing an archive page, the category archive, you go in here, it says what is the page, it's an Archive Page and it's Category Archive.
Okay, in that case, we're going to use the category.php template, right here, or if we are more specific about our call, we can also use the category ID template or even the category slug template. If none of these files exit, we fall back to archive.php and then everything gets displayed. The same goes if you're looking at a single post. You ask, what kind of page is it? It's a Singular Page, it's a Single Post Page and this is a Blog Post which means we'll use single post.php, and if single post.php doesn't exist, we're going to use single.php instead and if none of these template files exit, we fall back to index.php.
So when you're editing template files in WordPress themes, what you have to think about is what type of content this is and then edit the appropriate template file for that type of content. This may seem confusing at first but once just start working with it you will quickly see that there's a very clear system here and that by knowing what template file to edit you'll be able to control every aspect of what comes out the other end when people access your WordPress site.
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.