-
Notifications
You must be signed in to change notification settings - Fork 33
/
functions.php
55 lines (45 loc) · 1.81 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Bootstrap theme.
*
* The purpose of this file is to bootstrap your theme by loading all dependencies and helpers.
*
* YOU SHOULD NORMALLY NOT NEED TO ADD ANYTHING HERE - any custom functionality unrelated
* to bootstrapping the theme should go into a service provider or a separate helper file
* (refer to the directory structure in README.md).
*
* @package MyApp
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Define a content width for the theme.
*
* @link https://developer.wordpress.com/themes/content-width/
*/
if ( ! isset( $content_width ) ) {
$content_width = 1080;
}
// Make sure we can load a compatible version of WP Emerge.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'version.php';
$name = trim( get_file_data( __DIR__ . DIRECTORY_SEPARATOR . 'style.css', [ 'Theme Name' ] )[0] );
$load = my_app_should_load_wpemerge( $name, '0.17.0', '2.0.0' );
if ( ! $load ) {
// An incompatible WP Emerge version is already loaded - stop further execution.
// my_app_should_load_wpemerge() will automatically add an admin notice.
return;
}
// Load composer dependencies.
$autoload = locate_template( 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php' );
if ( ! empty( $autoload ) ) {
require_once $autoload;
}
my_app_declare_loaded_wpemerge( $name, 'theme', __FILE__ );
// Load helpers.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'MyApp.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'helpers.php';
// Bootstrap theme after all dependencies and helpers are loaded.
\MyApp::make()->bootstrap( require __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config.php' );
// Register hooks.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'hooks.php';