diff --git a/composer.json b/composer.json index c7274646f5..d28912cdef 100644 --- a/composer.json +++ b/composer.json @@ -26,13 +26,7 @@ "autoload": { "psr-4": { "Roots\\Sage\\": "src/lib/Sage/" - }, - "files": [ - "src/helpers.php", - "src/setup.php", - "src/filters.php", - "src/admin.php" - ] + } }, "require": { "php": ">=5.5.0", diff --git a/composer.lock b/composer.lock index 3bb9cda00f..6f8b895c9a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "bae0265fe64b728b3ad0fd3ab2ca2df0", + "hash": "7382dc6bb77190896306e1eb58b6589c", "content-hash": "75ad99c892e1d82404c58fe3bd989585", "packages": [ { diff --git a/functions.php b/functions.php index f8eecbb53d..6d43a4c068 100644 --- a/functions.php +++ b/functions.php @@ -23,6 +23,31 @@ 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 */