-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
160 lines (139 loc) · 3.89 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package kindling
* @since 3.0.0
*/
/**
* The theme version.
*
* @since 3.0.0
*/
define('KINDLING_VERSION', wp_get_theme()->get('Version'));
/**
* Check if the WordPress version is 6.0 or higher, and if the PHP version is at least 7.4.
* If not, do not activate.
*/
if (version_compare($GLOBALS['wp_version'], '6.0-RC4-53425', '<') || version_compare(PHP_VERSION_ID, '70400', '<')) {
include get_template_directory() . '/inc/back-compat.php';
return;
}
/**
* Add theme support for block styles and editor style.
*
* @since 3.0.0
*
* @return void
*/
function kindling_setup()
{
add_theme_support('wp-block-styles');
remove_theme_support('core-block-patterns');
}
add_action('after_setup_theme', 'kindling_setup');
/**
* Enqueue the CSS files.
*
* @since 3.0.0
*
* @return void
*/
function kindling_styles()
{
wp_enqueue_style(
'kindling-style',
get_stylesheet_uri(),
[],
KINDLING_VERSION
);
wp_enqueue_style(
'front',
get_theme_file_uri('build/front.css'),
[],
filemtime(get_template_directory() . '/build/front.css')
);
}
add_action('wp_enqueue_scripts', 'kindling_styles');
/**
* Enqueue the JS files.
*
* @since 3.0.0
*
* @return void
*/
function kindling_scripts()
{
wp_enqueue_script(
'front',
get_theme_file_uri('build/front.js'),
[],
filemtime(get_template_directory() . '/build/front.js')
);
}
add_action('wp_enqueue_scripts', 'kindling_scripts');
/**
* Enqueue the editor JS files.
*
* @since 3.0.0
*
* @return void
*/
function kindling_editor_assets()
{
// There are additional dependencies that can be added. For example `wp-data` but we want to keep this as lean as possible in the base theme. You may add more if needed in your project.
wp_enqueue_script(
'editor-js',
get_theme_file_uri('build/editor.js'),
['wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor', 'wp-dom-ready', 'wp-edit-post', 'wp-block-editor'],
filemtime(get_template_directory() . '/build/editor.js')
);
wp_enqueue_style(
'editor',
get_theme_file_uri('build/editor.css'),
[],
filemtime(get_template_directory() . '/build/editor.css')
);
// Block Variations
wp_enqueue_script(
'kindling-block-variations',
get_theme_file_uri('build/blockVariations.js'),
array('wp-blocks', 'wp-i18n', 'wp-dom-ready'),
filemtime(get_template_directory() . '/build/blockVariations.js'), // Version for cache busting.
true // In footer.
);
// Site Logo block extension - Mobile logo
wp_enqueue_script(
'kindling/mobile-site-logo',
get_theme_file_uri('build/block-extensions/mobile-site-logo.js'),
array('wp-blocks', 'wp-i18n', 'wp-components', 'wp-block-editor', 'wp-hooks'),
filemtime(get_template_directory() . '/build/block-extensions/mobile-site-logo.js'), // Version for cache busting.
true // In footer.
);
}
add_action('enqueue_block_editor_assets', 'kindling_editor_assets');
// Helpers.
require_once get_theme_file_path('inc/helpers.php');
// ACF Blocks.
require_once get_theme_file_path('inc/api.php');
require_once get_theme_file_path('inc/acf-blocks.php');
// Authors.
require_once get_theme_file_path('inc/authors.php');
// Block styles.
require_once get_theme_file_path('inc/block-styles.php');
// Block variations.
//require_once get_theme_file_path( 'inc/register-block-variations.php' );
// Block patterns.
require_once get_theme_file_path('inc/block-patterns.php');
// Block renders.
require_once get_theme_file_path('inc/block-renders.php');
// Disable comments
require_once get_theme_file_path('inc/comments.php');
// Google Analytics
require_once get_theme_file_path('inc/google-analytics.php');
// Theme Options Page
require_once get_theme_file_path('inc/options-page.php');
// Shortcodes
require_once get_theme_file_path('inc/shortcodes.php');