I am creating a theme framework to use in future wordpress themes that I develop. I would like to include dependant files such as classes inside the parent theme before the child theme functions.php gets loaded. This way the child theme doesn't need to include the classes.
I'll try to show an example:
parent-theme - file.php:
require_once get_template_directory().'/classes/Core.php';
require_once get_template_directory().'/classes/Core_View.php';
$CoreView = new Core_View();
$CoreView->init();
child-theme - functions.php:
require_once get_template_directory().'/classes/ContentSidebarView.php';
$ContentSidebarView = new ContentSidebarView();
$ContentSidebarView->init();
ContentSidebarView Class file:
Class ContentSidebarView extends Core_View{
public function init(){
// Do Something
}
}
Currently, I get an error that class Core_View is not found when I use the child theme. This isn't the case if I just use the parent theme.
What I'd Like: I would like to require only the template in the child theme and initiate it. This means that the Core_View would have to already be loaded.
I am also open to suggestions as to how to initiate the template. Maybe it would be better in the child theme index file?