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.
Working on the Internet, you're bound to run into situations where your site goes down. And working with child themes, it's quite likely that at some point or another, you make a small error that causes the site to either break or go down completely. I like to say that the web is an inherently unstable platform, and we as web developers just work to make it appear as if the web is stable. That is very true for WordPress, because although when everything works fine, WordPress works great, you only need to make a tiny little mistake, and it has enormous consequences for your site.
Fortunately, because of how WordPress is built, the fact that the site goes down or breaks doesn't really mean much, because all you have to do is just fix the small error, and it will come back up again. So let me address two very common issues that arise when you work with child themes. The first one is a standard code error. Throughout this course, we have been adding a lot of functions and functionalities to the site editing different pages and different templates. Let me show you what happens if you make a tiny coding error in the wrong place.
I'll open functions.php, and make a code error. So I'll simply delete this curly bracket here. I'll save it, reload the page and my website disappeared. But worse than that, I can't access it at all. I can try to go to wp-admin, nothing. So I cannot access my site at all from the web anymore. And all I did was removed a curly bracket. But the great thing about working with child themes and also about working with WordPress is that when things like that happen, you can force WordPress to revert back to a stable state.
The easiest way to do that is to simply go to your themes folder, and rename the folder for your child theme. So I'll rename this to your child theme, BROKEN, and reload my page. And what happens now is WordPress tries to find the child theme, can't find it, and gives you an error. The themes directory is either empty or doesn't exist. Please check your installation. What really happened was WordPress fell back on a default theme. So now, you have Twenty Eleven activated, or you may have Twenty Twelve activated.
The child theme is still there, but as we know, it doesn't work. So now that it doesn't work, I can go back and edit it so that I can make it work again, and then put it back online. So I can go back into my theme, open functions.php, fix my error, and rename the folder. Then I just have to go back to the site, reload the Themes page, and reactivate Child of Twenty Twelve.
And with that, my site is back online and everything is fine. The second common error is also done in functions.php. But you could accidentally do it other places too. It's very common that people make new functions like these ones. But they use function names that match existing function names either in WordPress or in the parent theme. If you do, you get a double function, and if everything isn't set up to handle double functions, you get massive code errors in the process.
It's very easy to avoid this. All you have to do is give your new functions a proper name that's different from the parent theme function. The general rule is to simply add something like mytheme_ and then the description of the function. Through this course, I have actually added a couple of different names, and to be honest with you, that's a bit sloppy. I should've actually given everything the same name so it's easy to understand. But you get my drift. By saying mytheme_ in front of each function or mychildtheme_ or something like that or even the name of the theme, you're avoiding the chance of anything overwriting the existing theme or crashing with WordPress.
The default in WordPress is that everything is either started with WP or it just spells out the function itself. So if you always add either your own name or the name of the theme or something else at the front of each function, you'll never clash with anything else. WordPress site crashes can be pretty disturbing, but it's very rare indeed that a WordPress site truly goes down. In almost every case, the site crash is caused by either bad code or a conflict in the theme or plug-in.
That means, retracing your steps or if the worst comes to worst, disabling your child theme, will usually get you back up and running just like that.
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.