Get it All

For nearly as long as there has been a WordPress, themes have included a functions.php file. This file provides a lot of extra, for lack of a better word, “functionality” to your WordPress blog. And while so much else about WordPress has changed over the years, it is quite remarkable how little about the functions.php file has evolved.

This is particularly true in light of WordPress’ ability to create child themes. Child themes are separate themes which extend the functionality of their “parent” themes by overriding key theme files. A child theme may only have a style.css file, to refer back to the parent. Or it might include a single.php file, because in the case of this one theme, you want all the functionality of the parent, but you’d like single posts and pages handled differently.

The trouble is: while a template file can override it’s parent, the WP functions.php file just basically loads the namespace with a bunch of free-floating functions, usually prepended with the name of the theme. There isn’t any “overriding” a function in PHP; the only thing you can do is write another function with still another name or prefix. That’s not very efficient use of the namespace and a recipe for confusion.

Instead, what I decided to try was putting my entire list of functions inside a class. Call it ParentFunctions. Inside this class, I also included a self-named initialization function that would do the adding of filters and actions as necessary. Then, all I need to do is instatiate my object – and be sure to call the “global” in each file where its necessary – and I’ve got an extensible model from which to create child themes.

Let’s look at ParentFunctions:

Among the advantages, here, is that our namespace is much cleaner. So is our code: instead of having to trawl through a couple dozen prefix_function_name entries, I can get straight to function_name. But better still, if I want to modify how a function works in a child theme, that’s even easier:

Using classes in your WP functions.php file provides a cleaner, easier interface for extending your themes for whatever you need.

If you’re like me, you design web pages because you have a passion for data and display, both. But that may not necessarily mean – and in my case, it most certainly does not mean – that you have a natural ability for dealing with color. Primary colors are one thing, but getting the subtlety and nuance of really rich, vibrant colors is something altogether different. In fact, there are people in interior decorating, graphic design and other industries whose sole job it is to select colors.

In the past, the limitations of browsers and operating systems gave us a great excuse: we *had* to stick to Web Safe RGB, so exotic colors simply were not possible. Well, that excuse is long-past expired. So, what’s your excuse now?

Finding new and interesting colors can be a challenge. Even for artists, finding the colors they love in the real world available to them in the digital world is a daunting task. But with all those experts out there, certainly there must ways to find color combinations besides your own personal brain power? I decided to make a list of some outside-the-box options for your edification. Your comments and suggestions are heartily encouraged.

5. Why Not Ask Sherwin Williams?

The Sherwin Williams website is an excellent resource for color matching palettes of all kinds. Of particular interest to me is the historical palettes section of their website. Here you will find sample selections of the color schemes which provided the inspiration for interior decorating throughout various eras. Look to this resource to find some interesting background colors or text area colors and match them elsewhere.

“But wait!” you may be saying, “how can I use these color options when they’re only images? How do I get the hexs for them?”

The answer is your eye dropper tool in Photoshop. Save the image you want to sample and open it up in Photoshop. Then just use the eye dropper tool to get the sample. Double-click the color in the Color-Selection Box. In the window that opens, you will find the hexidecimal value for the color you’ve selected.

4. Photoshop Swatch Palettes

Another great resource for interesting colors is Photoshop’s swatch palettes. The prepackaged color palettes include Renaissance themed colors and Art-Deco stuff, plus lots more. Once again, you can select the color and then double-click the Color-Selection Box to get the hex. Of course, as a pro tip, you’ll want to eventually save the colors you select for your theme as your own custom palette. You’ll probably want to create a custom palette for every website you work on, if you’re planning on ever coming back to it.

3. Old House Colors

Here’s an interesting website. is really meant for house painters and owners who want their houses to have the classic look that their homes were meant to have. But information on the web is free, and that means its freely used! There’s lots of color possibilities here that you may not find, exactly, anywhere else.

2. What about Macy’s?

Yes. Macy’s. Or, if you like. But clothing is some of the most color-rich stuff most of us ever touch. Why not use some of the swatches they have on their sites for inspiration? You can make an entire WordPress theme and base it around a Polo Ralph Lauren suit! The point is to find colors you can:

  1. Easily sample and use
  2. Dig enough to use in the first place!

1. Color Scheme Designer 3

Beyond a doubt, the best resource for coming up with balanced themes, the Color Scheme Designer uses the science of color to come up with companion colors for whatever favourite color you’ve discovered. The best part of this resource is that it provides you six different palette options for your chosen color, based on their relationship to one another on the color wheel. I am sure that color professionals can explain how all this works. What I can say is that it works beautifully. And it provides you color combinations which, when viewed, make perfect sense yet seem – to me, anyway – totally surprising.

This may be apropos of nothing for a lot of people, but just as a helpful little hint, you can get the theme used by a blog by calling the get_option() method thusly:


I’m using this on a plugin that changes the colors of certain objects (not CSS directable) by checking the current theme and setting matching colors. Think “custom color YouTube video window.”

MU admins, you could use get_site_option() if you’re planning on doing something global.

There’s lots of information available on WordPress’s codex about how to create themes for your blog, all of it dealing with the filters and actions you can use to manipulate the active content on your blog in cool ways. It goes without saying that those are important pieces of information, and in fact there are some outstanding tutorials for putting together a theme that you should definitely check out. WPBits is one such resource.

But I’d like to talk about some concepts that happen before you get to the active content: the HTML, and how you go about designing a theme which has to exist in all those varying pieces yet all go together to create one cohesive whole. This is a very high-level tutorial, meaning that specific details will be omitted in order to introduce the most basic concepts. I’m writing more about the workflow than about the process, if you follow me!

Continue reading