Step by step guide to making a TwentyTen child theme
Step 5: Cleaning up the admin
The Twenty Ten originally allowed users to modify the header image and background colour. These options no longer make any sense since we’ve removed the banner from our header and our design would look strange with a background other than white. This is not a problem if you are going to use this theme yourself, but if this is for a client, they may wonder why these options are there.
To remove these, we need to create a separate functions.php file and call our own set up function which will remove both custom header images and custom background. The following code snippet should be added a new file in your theme called functions.php.
Our final functions.php file contains the following:
<?php // The TwentyTen theme offers the ability to upload a banner and change the background colour. // To remove these options, let's do the following: function blm_theme_setup() { remove_custom_background(); remove_custom_image_header(); } add_action( 'after_setup_theme', 'blm_theme_setup', 11); ?>
You can use whatever prefix you want for your functions. I use blm (short for bluelimemedia)… pick something that will be unique to you. Both functions are obvious, they will remove the background and image. What’s not that obvious is the priority of the action. The default is 10, thus by stipulating 11 in our action, we insure that this action is carried out last and thus after the initial twentyten set up.