Move Sage includes from autoloader back to functions.php to fix issues including in Bedrock

This commit is contained in:
Matthew Henkler
2016-03-25 10:29:59 -05:00
parent bf31b59c6a
commit a994889f9a
3 changed files with 27 additions and 8 deletions

View File

@@ -23,6 +23,31 @@ add_action('after_switch_theme', function () {
basename($stylesheet) == 'templates' || update_option('stylesheet', $stylesheet . '/templates');
});
/**
* Sage includes
*
* The $sage_includes array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*
* Please note that missing files will produce a fatal error.
*
* @link https://github.com/roots/sage/pull/1042
*/
$sage_includes = [
'src/helpers.php', // Helper functions
'src/setup.php', // Theme setup
'src/filters.php', // Filters
'src/admin.php' // Admin
];
foreach ($sage_includes as $file) {
if (!$filepath = locate_template($file)) {
trigger_error(sprintf(__('Error locating %s for inclusion', 'sage'), $file), E_USER_ERROR);
}
require_once $filepath;
}
unset($file, $filepath);
/**
* Require composer autoloader
*/