forked from wpengine/frost
-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
199 lines (176 loc) · 5.05 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
/**
* Ash WordPress theme.
*
* It is built on top of Frost, a theme by WP Engine.
*
* @package Ash
* @author Linchpin
* @license GNU General Public License v2 or later
* @link https://github.com/linchpin/ash/
*/
// x-release-please-start-version
define('ASH_THEME_VERSION', '1.0.6'); // Version number is bumped automatically by release please
// x-release-please-end
define('ASH_THEME_NAME', esc_html__('Ash', 'Ash'));
define('ASH_THEME_INC', get_stylesheet_directory() . '/includes/');
define('ASH_THEME_DEBUG', false);
if (!defined('SCRIPT_DEBUG')) {
define('SCRIPT_DEBUG', true); // Enable script debug by default. Should be disabled in production.
}
// Define our includes
require_once ASH_THEME_INC . 'utilities.php';
require_once ASH_THEME_INC . 'navigation.php';
require_once ASH_THEME_INC . 'core.php';
if (!function_exists('ash_setup')) {
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*
* @since 0.8.0
*
* @return void
*/
function ash_setup()
{
// Make theme available for translation.
load_theme_textdomain('ash', get_template_directory() . '/languages');
// Enqueue editor styles and fonts.
add_editor_style(
array(
'./css/ash.css',
)
);
// Enqueue editor stylesheet.
add_editor_style( get_template_directory_uri() . '/style.css' );
// Remove core block patterns.
remove_theme_support('core-block-patterns');
}
}
add_action('after_setup_theme', 'ash_setup');
add_action('wp_enqueue_scripts', 'ash_enqueue_style_sheet');
function ash_enqueue_style_sheet()
{
wp_enqueue_style('ash', get_template_directory_uri() . '/css/ash.css', array(), wp_get_theme()->get('Version'));
}
/**
* Register block styles.
*
* @since 0.9.2
*/
function ash_register_block_styles()
{
$block_styles = array(
'core/button' => array(
'fill-base' => __('Fill Base', 'ash'),
'outline-base' => __('Outline Base', 'ash'),
),
'core/columns' => array(
'columns-reverse' => __('Reverse', 'ash'),
),
'core/group' => array(
'shadow' => __('Shadow', 'ash'),
'shadow-solid' => __('Solid', 'ash'),
),
'core/image' => array(
'shadow-light' => __('Shadow', 'ash'),
'shadow-solid' => __('Solid', 'ash'),
),
'core/list' => array(
'no-disc' => __('No Disc', 'ash'),
),
'core/navigation-link' => array(
'outline' => __('Outline', 'ash'),
),
'core/social-links' => array(
'outline' => __('Outline', 'ash'),
'core/quote' => array(
'shadow-light' => __( 'Shadow', 'ash' ),
'shadow-solid' => __( 'Solid', 'ash' ),
),
'core/social-links' => array(
'outline' => __( 'Outline', 'ash' ),
),
);
}
// Require Composer autoloader if it exists.
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
add_action('init', 'ash_register_block_styles');
/**
* Registers block categories, and type.
*
* @since 0.9.2
*/
function ash_register_block_pattern_categories()
{
/* Functionality specific to the Block Pattern Explorer plugin. */
if (function_exists('register_block_pattern_category_type')) {
register_block_pattern_category_type('ash', array('label' => __('Ash', 'ash')));
}
register_block_pattern_category(
'ash-page',
array(
'label' => __('Page', 'ash'),
'description' => __('Create a full page with multiple patterns that are grouped together.', 'ash'),
)
);
register_block_pattern_category(
'frost-pricing',
array(
'label' => __('Pricing', 'ash'),
'description' => __('Compare features for your digital products or service plans.', 'ash'),
)
);
$block_pattern_categories = array(
'ash-footer' => array(
'label' => __('Footer', 'ash'),
'categoryTypes' => array('ash'),
),
'ash-general' => array(
'label' => __('General', 'ash'),
'categoryTypes' => array('ash'),
),
'ash-header' => array(
'label' => __('Header', 'ash'),
'categoryTypes' => array('ash'),
),
'ash-page' => array(
'label' => __('Page', 'ash'),
'categoryTypes' => array('ash'),
),
'ash-query' => array(
'label' => __('Query', 'ash'),
'categoryTypes' => array('ash'),
),
'ash-proposals' => array(
'label' => __('Proposals', 'ash'),
'categoryTypes' => array('ash'),
),
'core/quote' => array(
'shadow-light' => __('Shadow', 'ash'),
'shadow-solid' => __('Solid', 'ash'),
),
'core/social-links' => array(
'outline' => __('Outline', 'ash'),
),
);
foreach ($block_pattern_categories as $name => $properties) {
register_block_pattern_category($name, $properties);
}
}
add_action('init', 'ash_register_block_pattern_categories', 9);
if (!function_exists('wp_body_open')) {
do_action('wp_body_open');
}
// Kick everything off when plugins are loaded.
try {
Ash\Core\setup();
Ash\Blocks\setup();
} catch (Exception $e) {
wp_die(esc_html($e->getMessage()));
}