Add 'web/app/themes/badegg/' from commit 'b31aa7550b02a4516fdf161f53dc7666854c9a14'
git-subtree-dir: web/app/themes/badegg git-subtree-mainline:b862ff9755git-subtree-split:b31aa7550b
This commit is contained in:
83
web/app/themes/badegg/functions.php
Normal file
83
web/app/themes/badegg/functions.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use Roots\Acorn\Application;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader for
|
||||
| our theme. We will simply require it into the script here so that we
|
||||
| don't have to worry about manually loading any of our classes later on.
|
||||
|
|
||||
*/
|
||||
|
||||
if (! file_exists($composer = __DIR__.'/vendor/autoload.php')) {
|
||||
wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
|
||||
}
|
||||
|
||||
require $composer;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Bootloader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The first thing we will do is schedule a new Acorn application container
|
||||
| to boot when WordPress is finished loading the theme. The application
|
||||
| serves as the "glue" for all the components of Laravel and is
|
||||
| the IoC container for the system binding all of the various parts.
|
||||
|
|
||||
*/
|
||||
|
||||
Application::configure()
|
||||
->withProviders([
|
||||
App\Providers\ThemeServiceProvider::class,
|
||||
])
|
||||
->boot();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoload PSR-4 files
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function autoload_psr4($name) {
|
||||
$path = __dir__ . '/app/' . $name . '/*.php';
|
||||
$namespace = 'App\\' . $name;
|
||||
|
||||
foreach(glob($path) as $filename) {
|
||||
$class = $namespace . '\\' . basename($filename, '.php');
|
||||
new $class();
|
||||
}
|
||||
}
|
||||
|
||||
autoload_psr4('PostTypes');
|
||||
autoload_psr4('ACF');
|
||||
autoload_psr4('Utilities');
|
||||
autoload_psr4('Admin');
|
||||
autoload_psr4('Blocks');
|
||||
autoload_psr4('Ajax');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Sage Theme Files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Out of the box, Sage ships with categorically named theme files
|
||||
| containing common functionality and setup to be bootstrapped with your
|
||||
| theme. Simply add (or remove) files from the array below to change what
|
||||
| is registered alongside Sage.
|
||||
|
|
||||
*/
|
||||
|
||||
collect(['setup', 'filters'])
|
||||
->each(function ($file) {
|
||||
if (! locate_template($file = "app/{$file}.php", true, true)) {
|
||||
wp_die(
|
||||
/* translators: %s is replaced with the relative file path */
|
||||
sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user