Problem: You want to take advantage of WordPress Parent-Child Themes but you want more control than is usually afforded through CSS alone. What about adding a Favicon? Or a link to a custom stylesheet for IE fixes.? Or editing the menu? How do you do that without messing around with the original Parent Theme?
Solution: You do what I did. I had this exact same problem redesigning ThemeShaper to take advantage of my WordPress Theme Framework, Thematic. I’ll tell you how I solved it and give you a better idea of the power of the functions.php
file in WordPress Child Themes.
When you’re done reading this post you should be well on your way to taking full advantage of the power of WordPress Child Themes and redesigning your blog the smart way—leaving the original parent theme files untouched.
And if you haven’t heard about WordPress Child Themes before, make sure you take a look at my post on How To Protect Your WordPress Theme Against Upgrades. I go through a quick primer on them and how to get started using them (along with some useful tips on using Plugins).
First, Make a Functions.php File
Currently, only two overriding files are recognized in WordPress Child Themes, style.css
and functions.php
(unless my proposal for 2.7 makes it in). You can do a lot with CSS alone but with functions.php
your theme can interact with WordPress just like a plugin.
First things first: make a file in your Child Theme folder called functions.php
and add the PHP opening and closing tags to the first and second line (<?php
and ?>
) using your favorite text editor (I use Smultron). Make sure you don’t have any extra lines before or after these tags. We’re going to be inserting the following snippets of code on the lines in-between these tags. Now you’re ready to make your WordPress Child Theme sing.
… not literally, of course. That would be annoying. Continue reading “How I used a WordPress Child Theme To Redesign My Blog”