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.
At the core of all WordPress themes lies a file named functions.php. As the name suggests, the functions.php file contains core functions that make the theme work. These functions range from simple bits of code that activate code WordPress functionality to advanced functions you can modify to add new functionality and new features to the theme and to the site. Understanding the role and function of functions.php will enable you to go from simply messing with the template files in CSS to adding whole new levels of awesomeness to your site.
Yes, I said it: awesomeness. Opening functions.php for the first time can be a bit of a shock, because it's a very complicated file--or at least it appears to be a very complicated file--and is also chock-full of lots of stuff that doesn't seem to be related to each other in any sensible way. The good theme about the twentytwelve theme and the other core themes from WordPress is that they come heavily documented, meaning there's lots of explanations inside the files that explain what these files do.
And that's especially true for functions.php in twentytwelve. There is lots of documentation explaining what's going on throughout the functions file. If you look at the functions file, I'll show you some examples of what this file actually does. If you skip down to line 61, you'll see here we have a simple function called add_theme_support. This function adds different types of theme support, for example post-formats. So here you can see post-formats are activated and then there is a list of what types of post formats are activated, because there are several different types of formats you can activate if you want to and twentytwelve uses five of these post formats.
Directly underneath, you have this function, register_nav_menu, where the different nav menus are registered, so that you can creates menus inside WordPress Admin. And below that, you have add_theme_ support for a custom background, so that you can set different custom background colors for your theme from within WordPress Admin. Moving down the file, you'll see on line 195 we have the function that creates all the widgetized areas. Here you can see we have three widgetized areas. We have Main Sidebar, and then we have First Front Page Widget Area and Second Front Page Widget Area.
So when you ask where the widgets come from, this is actually where they come from, functions.php. And if we scroll further down, to line 258, you'll see where the comments come from. This is actually after the template that creates the comments section on your site. So when you want to work with comments you need to work with the code inside function.php and also inside comments.php. What I have shown you here is just a small selection of what's in functions.php, and we're now going to work with function.php to augment what's in there already and also add new stuff to the file.
functions.php holds a lot of behavioral elements of a WordPress theme, and understanding how it works and how to interact with it will allow you to make truly advanced themes that work the way you want them to. Fortunately, the 2012 developers have left excellent documentation right in functions.php file, so it's easy for you to figure out what's going on.
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.