-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
92 lines (73 loc) · 2.35 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* This file bootstraps the theme by creating the core Theme class instance.
*
* phpcs:disable NeutronStandard.Functions.VariableFunctions.VariableFunction
*/
declare(strict_types=1);
namespace DoWStarterTheme;
use DoWStarterTheme\Core\Config;
use DoWStarterTheme\Core\Theme;
use DoWStarterTheme\Factories\Filesystem;
use DoWStarterTheme\Requirements as Checkers;
use DoWStarterTheme\Deps\Micropackage\Requirements\Requirements;
/**
* Composer autoload file
*/
$dowstAutoloader = __DIR__ . '/vendor/autoload.php';
if (!file_exists($dowstAutoloader)) {
// Composer autoload file does not exist.
$dowstTitle = __('Autoloader not found.', 'dow-starter-theme');
$dowstDescription = __('You must run <code>composer install</code> from the theme directory.', 'dow-starter-theme');
$dowstMessage = "<h1>{$dowstTitle}</h1><p>{$dowstDescription}</p>";
wp_die($dowstMessage, $dowstTitle);
}
// Require autoloader.
require_once $dowstAutoloader;
// Create root Filesystem instance.
$dowstFs = Filesystem::get(__DIR__, 'root');
// Create Requirements instance.
$dowstRequirements = new Requirements(
'DoW Starter Theme',
[
'assets' => true,
'customizer' => true,
'dochooks' => true,
'php' => '7.4',
'php_extensions' => ['SimpleXML'],
'plugins' => [
[
'file' => 'advanced-custom-fields-pro/acf.php',
'name' => 'Advanced Custom Fields Pro',
],
],
'wp' => '5.8',
]
);
$dowstRequirements->register_checker(Checkers\AssetsChecker::class);
$dowstRequirements->register_checker(Checkers\CustomizerChecker::class);
if (!$dowstRequirements->satisfied()) {
$dowstMessage = sprintf(
/* Translators: %s is a theme name. */
__('The theme: %s cannot be activated.', 'dow-starter-theme'),
'<strong>DoW Starter Theme</strong>'
);
if (is_admin()) {
$dowstRequirements->print_notice($dowstMessage);
} else {
$dowstRequirements->kill($dowstMessage);
}
return;
}
// Create core class instance.
$dowstTheme = Theme::get($dowstFs);
// Add WordPress actions and filters.
$dowstTheme->add_hooks();
// Bootstrap the Theme, create class instances.
$dowstTheme->bootstrap(Config::get('classes.general'));
// Add widgets to be registered.
$dowstTheme->addWidgets(Config::get('classes.widgets'));
// Add theme support.
$dowstTheme->addThemeSupport(Config::get('theme-support'));
// Add image sizes.
$dowstTheme->addImageSizes(Config::get('image-sizes'));