Operation: Recode Every Theme in My Shop

I’ve started undertaking a big theme recoding project. I’m recoding all the themes in my shop.

Pretty much every 6-12 months I look back on my old work and think, “I can do it better.”

A lot of my themes haven’t been thoroughly updated over time. I just fix bugs, add new features, and so on. But I haven’t really gone back and done a total overhaul. It’s time!

Here are my main goals with this process:

1) Consistent function prefixes.

The functions in my themes are kind of a mess. Some of them don’t have prefixes at all, and the ones that do are often prefixed with ng_ (for “Nose Graze”) or even cw_ (for the old “Creative Whim”).

I’m going back and prefixing all functions with the theme slug. So instead of ng_get_featured_image() we’d have tweakme2_get_featured_image().

This makes everything nice and consistent throughout teach theme.

2) Well documented and organized code.

I want each theme to be coded with the expectation that someone else is going to read through the code and try to understand it. That isn’t the case with like 95% of my clients, but I want to act as if it is.

  • I want proper comment blocks for each function.
  • Clear descriptions of what each function does.
  • Expected output/return values of each function.
  • Comments within functions where necessary.

Here’s an example from the Eliza theme:


 * Gets the average rating for a taxonomy
function cw_ubb_average_rating( $term, $tax ) {


 * Get UBB Average Rating
 * Returns the average rating for a given taxonomy term.
 * @param object $term
 * @param string $tax
 * @return void
function eliza_ubb_average_rating( $term, $tax ) {

3) Functions divided across different files.

In many of my old themes, all functions are crammed into the functions.php file. I’m going back and moving functions into separate files based on what they’re used for. Using Eliza as an example again, here’s what the new structure looks like:

  • functions.php – Theme set up and includes other files.
  • inc/class-eliza-navigation-walker.php – Home for the custom navigation walker class (was previously packed into functions.php — eeks!!).
  • inc/extras.php – Functions not used directly in theme files. Primarily actions and filters.
  • inc/shortcodes.php – Custom shortcodes (but see later note on shortcodes!).
  • inc/template-tags.php – Functions used directly within template files. Used for displaying portions of templates (like post meta).

4) Splitting out functionality into new plugins.

This may displease some clients at first, but I promise, it’s for your own good. 😉

Some of my themes have extra features built in. For example, Tweak Me v2:

  • Has code to colour code posts (in Posts > All Posts) based on their status.
  • Adds custom profile fields to Users > Your Profile for inserting a post signature.

These kinds of features that aren’t related to the appearance of the site will be removed and put into plugins. It’s not a good idea to build functionality like this into the theme because then you lose it all when you switch themes later. So in order for my customers to keep this functionality, they’ll need to install the extra plugins (that’s the annoying bit, but you’ll thank me later if you ever switch themes 😉 ).

5) Deprecating shortcocdes.

This is a gnarly one.


They’re bad. (In themes.)

I added shortcodes into my themes when I first started coding for WordPress. I looked at sites like ThemeForest who were selling themes with ALL OF THE THINGS in them. It was basically a standard for themes to include shortcodes for buttons, alerts, tooltips, columns, and more. I was under the impression that a theme isn’t a theme unless you cram in all these extras.

But what happens when you switch themes later?

The shortcodes all stop working. They leave behind an ugly, horrible mess.

Because of that, I won’t be removing shortcodes completely. I don’t want to screw over people who are using them and also still using the theme. But I’m deprecating them. By that I mean:

  • I’ll no longer be advertising shortcodes as a theme feature.
  • I’ll be removing any and all visible references to shortcodes (removing visual editor buttons, notes about them in docs, etc.).

The shortcodes will still work if used, but I’m basically making them impossible to find for new customers. If you’re interested in using shortcodes, you should seek out a plugin that contains them.

6) Long Term: Move all settings into the Customizer

This is definitely a long-term goal.

Some of my older themes are using frameworks like Redux for the settings panel. My newer themes (like Duplicity) purely use the Customizer.

I want to migrate all themes (except maybe Tweak Me v2) to only the Customizer. This is a pretty long-term goal since I’d also need to code migration tools to import settings from the old framework to the Customizer (ugh). But also, I’m undecided about whether or not I’ll do this for Tweak Me v2. I was fully prepared to until I sent out a survey and a surprisingly large amount of people said they didn’t want to lose the “Theme Options” page. They weren’t thrilled about everything moving to the Customizer.

What do you think?

All of these changes will definitely take a lot of time.

It’s almost a bit sad since very few people will appreciate these changes since they’re all happening under the hood. But I know that improving the code base of my themes is only a good thing, even if customers don’t see it with their own eyes. And the small percentage of my clients who actually do read through the code will certainly be grateful. 😉

Photo of Ashley
I'm a 30-something California girl living in England (I fell in love with a Brit!). My three great passions are: books, coding, and fitness. more »

Don't miss my next post!

Sign up to get my blog posts sent directly to your inbox (plus exclusive store discounts!).

You might like these


  1. I hate the customizer. It feels like more hassle than it’s worth. Every time a theme forces me to use it and I have to make a change, something gets messed up and I end up frustrated and back to the old theme before it. I never use it. I think TMv2 is just so customizable that it needs the options panel. I feel like it would be a lot harder to work with in the customizer.

    This is going to be so much work. I wish you luck.

    1. This is where it gets very hard to please everyone. For each person who says they prefer a dedicated theme options page, there’s another complaining about the lack of live preview on that theme options page. 😛

  2. Hi Ashley,

    WOW, one thing is certain- you’ve got a lot of work ahead of you. 😉
    While I am not sure, how much some of these are going to influence theme performance, they are definitely going to make your later coding with them easier.

    I have the same opinion about shortcodes like you. They seem useful at first glance but every theme or plugin has it’s own… It’s better without them in the end.

    As for the Customizer, like all new things, it takes some time getting used to it, but now I like that I can see my changes implemented immediately without reloading my website.

    Keep up the good work and good luck!

    1. Yeah the goal isn’t to really improve the performance, but just to make the code cleaner, more organized, and easier to read/understand. 🙂

      So many people love shortcodes and often themes sell better if you have them… which sucks, because they’re actually very bad for the user down the road. :/ Some customer education is definitely needed here!

  3. Hmm, me thinks you need to make a shortcode plugin. I wouldn’t buy a theme that doesn’t have them of course this is what led me to have a custom theme..so it functioned the way I wanted..lol . As for the customizer both work so that really isn’t an issue.

  4. Oh oh, I was planning on buying your Tweak Me V2 within the next few weeks together with your UBB plugin. But when you are planning on cutting out a page that seems to be highly appreciated and wanted by your customers, it doesn´t seem to be a good idea anymore 🙂 So what is better to do for me: buy it now as long as it is the way it is now (and further changes won´t affect me then) or wait till you´ve done all the changes you want to do and risk that this option is then gone? I am a bit confused here now 😉
    best wishes

      1. I was talking about this line here “…surprisingly large amount of people said they didn’t want to lose the “Theme Options” page.”

          1. Don´t get me wrong, Ashley 🙂 I am not criticising you or your work – not after all your kindness, what I´ve learned from you and your patience with me over the past few weeks. I have no reason at all to do so. I was just wondering what would be best. And I have nothing against customizing things. The more I can do myself, the happier I am. The line I mentioned earlier sounded to me like you were planning on taking it out of the template, and that all the ones, who are using your Tweak Me V2 theme are happy to have that opportunity in it and don´t wanted that gone. That was the reason why I asked what to do, that´s all 🙂

            1. I’m just trying to gather feedback. 🙂 And I’m wondering if perhaps you’re misinterpreting what I’m saying.

              Right now all the theme options are inside a dedicated options page called “Theme Options”. You can’t preview the settings as you make them. You have to configure them, press “Save”, then view your theme. That’s why it can be a bit tedious.

              My plan is to move those settings to the built-in WordPress “Customizer” page. This Customizer page gives you a live preview of all the changes you’re making so you can see them before you go live. You can see each change take effect on your site immediately — but before you save the changes so everyone else can see them.

              So I just want to clarify that my plan isn’t to remove the settings panel. My plan is to move the settings panel to a different area that gives you a live preview of all the changes you’re making.

              1. Oh I see! And yes, I obviously misinterpreted you. What you are about to do, is what I already can do/have in Blogger. Well in that case I´d say it is a great idea if you can make that possible. And it would improve your template (s), for sure 🙂

  5. Ya know, I never got into using shortcodes, besides the ones that I can “plugin” and they go nicely home into my TinyMCE, which I’m currently mad at (stupid update). I’d rather have everything un-spun from the code so it’s neat and I can find it!

    I get it.

    Now, when you’re done, can you clean up my folders on my server? 😉 I have an aneurysm every time I look at them…

Recent Posts

    Random Posts