1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Flynt\Init; |
4
|
|
|
|
5
|
|
|
use Flynt; |
6
|
|
|
use Flynt\Utils\Asset; |
7
|
|
|
use Flynt\Utils\Feature; |
8
|
|
|
use Flynt\Utils\FileLoader; |
9
|
|
|
use Flynt\Utils\StringHelpers; |
10
|
|
|
use Timber\Timber; |
11
|
|
|
|
12
|
|
|
add_action('after_setup_theme', __NAMESPACE__ . '\\initTheme'); |
13
|
|
|
add_action('after_setup_theme', __NAMESPACE__ . '\\loadFeatures', 100); |
14
|
|
|
add_action('after_setup_theme', __NAMESPACE__ . '\\loadComponents', 101); |
15
|
|
|
|
16
|
|
|
function initTheme() |
17
|
|
|
{ |
18
|
|
|
// initialize plugin defaults |
19
|
|
|
Flynt\initDefaults(); |
20
|
|
|
|
21
|
|
|
// Set to true to load all assets from a CDN if there is one specified |
22
|
|
|
Asset::loadFromCdn(false); |
23
|
|
|
|
24
|
|
|
// WP Stuff |
25
|
|
|
add_theme_support('title-tag'); |
26
|
|
|
add_theme_support('post-thumbnails'); |
27
|
|
|
|
28
|
|
|
new Timber(); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
function loadFeatures() |
32
|
|
|
{ |
33
|
|
|
$basePath = get_template_directory() . '/dist/Features'; |
34
|
|
|
|
35
|
|
|
Feature::register('flynt-youtube-no-cookie-embed', $basePath); |
36
|
|
|
|
37
|
|
|
// initialize ACF Field Groups and Option Pages |
38
|
|
|
Feature::register('flynt-acf', $basePath, [[ |
39
|
|
|
'FlexibleContentToggle', |
40
|
|
|
'GoogleMaps' |
41
|
|
|
]]); |
42
|
|
|
|
43
|
|
|
// enable admin notices |
44
|
|
|
Feature::register('flynt-admin-notices', $basePath); |
45
|
|
|
|
46
|
|
|
// use timber rendering |
47
|
|
|
Feature::register('flynt-timber-loader', $basePath); |
48
|
|
|
|
49
|
|
|
// load jQuery in footer by default |
50
|
|
|
Feature::register('flynt-jquery', $basePath); |
51
|
|
|
|
52
|
|
|
// clean up some things |
53
|
|
|
Feature::register('flynt-clean-head', $basePath); |
54
|
|
|
Feature::register('flynt-clean-rss', $basePath); |
55
|
|
|
Feature::register('flynt-mime-types', $basePath); |
56
|
|
|
Feature::register('flynt-remove-editor', $basePath); |
57
|
|
|
Feature::register('flynt-tiny-mce', $basePath); |
58
|
|
|
Feature::register('flynt-base-style', $basePath); |
59
|
|
|
|
60
|
|
|
// add components previews |
61
|
|
|
Feature::register('flynt-admin-component-preview', $basePath); |
62
|
|
|
|
63
|
|
|
// google analytics |
64
|
|
|
Feature::register('flynt-google-analytics', $basePath); |
65
|
|
|
|
66
|
|
|
// hide protected posts |
67
|
|
|
Feature::register('flynt-hide-protected-posts', $basePath); |
68
|
|
|
|
69
|
|
|
// move yoast seo plugin box to the bottom of the backend interface |
70
|
|
|
Feature::register('flynt-yoast-to-bottom', $basePath); |
71
|
|
|
|
72
|
|
|
Feature::register('flynt-password-form', $basePath); |
73
|
|
|
Feature::register('flynt-external-script-loader', $basePath); |
74
|
|
|
Feature::register('flynt-lodash', $basePath); |
75
|
|
|
Feature::register('flynt-component-log-server', $basePath); |
76
|
|
|
|
77
|
|
|
do_action('Flynt/afterRegisterFeatures'); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
function loadComponents() |
81
|
|
|
{ |
82
|
|
|
$basePath = get_template_directory() . '/dist/Components'; |
83
|
|
|
global $flyntCurrentOptionCategory; |
84
|
|
|
$flyntCurrentOptionCategory = 'component'; |
85
|
|
|
Flynt\registerComponentsFromPath($basePath); |
86
|
|
|
do_action('Flynt/afterRegisterComponents'); |
87
|
|
|
} |
88
|
|
|
|