Override Genesis Theme Settings (with helper class)

This is old code and while it may still work it has not be updated or tested by me in a long time. Use at your own risk.

I use the Genesis Framework frequently with my full website development because it is a well-supported, powerful theme framework. It allows me to spend more time building the custom elements of a client’s site and less time working on the basic theme construction. I can leverage the vast amount of work already done building the theme to deliver a superior product at a competitive rate. All that is great, but it’s also a fun framework to use, too.

When building a custom site I often override genesis theme settings, and then remove the theme option metaboxes so client’s can’t accidentally mess up elements on their site. For instance, sometimes the custom child theme is specifically design to only show excerpts on the blog roll, or featured images of a specific size. These are both things I could set in the theme settings interface and import those settings to the live site. However, I like the ability to install a theme and go, without fussing about with inporting settings. I also recognize that if we don’t have options built into the child them, those settings shouldn’t be available to change.

So, that leads us to this place – set the option programmatically and remove the metabox. You can set defaults via a function, filter specific the theme settings to force them, and even remove theme setting metaboxes pretty easily. I put these together into a helper class to do that all more simply from your theme functions. Just drop this into your theme and reference in your functions.php file like so:

Here’s the helper class referenced above.

Check it out on Github.

Featured Image (license)Marcin Wichary

Update 2-23-15: The main class originally shown in the gist above was accidentally copied from an older version that didn’t work. I’ve updated it now to version 2.0.0 – using the magic __call() method – which works like a charm.