I start new projects by writing a child theme for the twentyeleven theme. I rarely design the new theme to use any of the options built into the twentyeleven theme (such as background color, etc). Those residual options don’t really hurt anything, but I’d like to get rid of them since they don’t do anything.
The trouble is that the theme options are declared in the parent theme’s functions.php, which is loaded along with (not instead of) the child theme’s functions.php file (so I could delete them but they’ll come back next upgrade).
Is there a way to remove or disable those theme options from my child theme? Perhaps something along the lines of a “remove_options()” function? Or perhaps something that would achieve that effect? In other words, the question is whether theme_options can be removed WITHOUT deleting/overriding the original function that added them.
I’m sure with enough puttering, I could hide the option with CSS or javascript… but c’mon.
After a second round of digging…
This is TOTALLY easy!
You can retrace my steps by starting here, but the code is pretty self-explanatory:
You can look these up in the codex. Remove_theme_support takes one of several strings that identify various options (besides just post-formats). The only issue I encountered is that they need to be called from a hook (you can’t just dumpt them into functions.php). I’m using
initbut there’s probably another one that’s more appropriated.The only thing I still haven’t figured out is how to remove the “Theme Options” page link that appears under Appearances. I know it’s added with
add_theme_page()but there doesn’t seem to be a handyremove_theme_page().UPDATE: I found it!
This is VERY poorly documented, but in the end it’s quite easy to do:
In my example, ‘themes.php’ targets the Appearances menu and ‘theme_options’ is the menu_slug used in the twentyeleven theme. Obviously these parameters will differ depending on which menu or submenu you’re editing. This page will point you in the right direction.
ps: Here’s how to get rid of templates from the parent theme that you don’t want to use:
THIS isn’t essential to my exact question, but it’s closely related and probably useful to anyone who’s trying to do what I’m doing.