So, one of the things, I started doing was "protecting" my child themes by moving everything out of functions.php. I create a folder called lib or custom with a file called functions.php (contains various functions) and/or child-setup.php (contains things like registering custom post types, custom taxonomies, meta boxes, registering/unregistering layouts/sidebars, theme support, image sizes, and site-wide changes like the moving or removing of post meta/breadcrumbs, etc.).
Then in my functions.php file, I add a few require_once statements with important titles and a death warning not to remove any of these statements. So a theme functions.php may look like:
[php]<?php
/********************************************************************************/
//DO NOT EDIT! EDITING THIS SECTION CAN HAVE SERIOUS RAMIFICATIONS!
// Start the engine
require_once(TEMPLATEPATH.'/lib/init.php');
//Start Child Theme engine
require_once(STYLESHEETPATH.'/lib/init.php');
//Custom Child Theme library
require_once(STYLESHEETPATH.'/custom/custom-footer.php');
require_once(STYLESHEETPATH.'/custom/child-setup.php');
require_once(STYLESHEETPATH.'/custom/functions.php');
/********************************************************************************/
//Add any extra functions, below here! Enjoy!
[/php]
Are there any tricks that you use?
Bruce says
Never thought of this. I just add changes directly to the child theme functions.php file. Your method does isolate customizations, but I can’t see other benefits?
Another thing I have done is in create a plugin file and name it something like Custom Functions. In that file I keep all functions needed to customize the admin area (header, footer, custom favicon, breadcrumbs, unregister widgets, hide wp reminder, change howdy greeting, disable dashboard widgets, add custom dashboard widgets, change contact methods in user profile, add a ‘client; custom role (use Members plugin to administer), and more).
This saves time in setting up a new install, and optimizes the admin (consistently are for clients.
When I find something new, I add it to the plugin file.
Hope this helps!