The functions.php
file executes at plugins_loaded
, with the Child Theme functions.php
executing before the Parent Theme functions.php
. That means that, in order to load functional sub-files in the Child Theme after the Parent Theme functions.php
executes, you simply need to hook your include()
calls after plugins_loaded
.
A usually safe action for such purposes is after_setup_theme
:
function wpse130681_load_dependent_functional_files() {
require_once get_template_directory().'/classes/ContentSidebarView.php';
$ContentSidebarView = new ContentSidebarView();
$ContentSidebarView->init();
}
add_action( 'after_setup_theme', 'wpse130681_load_dependent_functional_files' );
That said: if you’re running into issues such as this one, you’re probably doing something wrong in the first place. Just guessing from your code sample:
- Hook your class instantiation into an appropriate hook, such as
init
- Make your framework classes extensible via filters, and extend in your Child Theme via those filters.