I got the problem that i have to load my parent theme's
functions.php file before my child theme's
functions.php file loads. This is needed for the setup & init procedure. I looked at the hooks inside /wp_core_root/wp-settings.php (named:
The problem is that i don't know how to hook into there, because the first file i get is the child theme's
functions.php, so no
add_action( 'setup_theme', 'my_init_function' ); will work.
a) I know that plugins load earlier than theme and therefore can access even the initial Query, but i don't want to rely on a Plugin.
b) Here's the code (shortened) from wp-settings.php file
// happens a lot earlier: do_action( 'plugins_loaded' ); // localize stuff happening here do_action( 'setup_theme' ); // Load the functions for the active theme, for both parent and child theme if applicable. if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) include( STYLESHEETPATH . '/functions.php' ); if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) include( TEMPLATEPATH . '/functions.php' ); // first available hook, *after* functions.php was loaded do_action( 'after_setup_theme' );
I want to avoid two things: First a lot of explanation to users. Second the chance that someone breaks anything if the cuts the rope with accidently deleting the parents init procedure. People shall just play inside the functions.php without risking to break anything without knowing it.
In other words: How do i keep my child themes functions.php file clean, but have the the parent themes bootstrap done?
Any ideas? Thanks a lot!