-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
279 lines (229 loc) · 7.05 KB
/
functions.php
File metadata and controls
279 lines (229 loc) · 7.05 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?php if ( !defined('ABSPATH') ) die();
define( 'FSCHILD_THEME_VERSION', '1.0' );
define( 'FSCHILD_THEME_DIR', get_stylesheet_directory() );
define( 'FSCHILD_THEME_URL', get_stylesheet_directory_uri() );
// $primary = get_theme_mod('primary_color', '#23252b');
// $secondary = get_theme_mod('primary_color', '#606060');
// $accent = get_theme_mod('primary_color', '#8def12');
// $bg = get_theme_mod('bg_color', '#f0f0f0');
// $text_color = get_theme_mod('text_color', '#182C34');
// Gutenberg editor styles
function fschild_block_editor_styles() {
wp_enqueue_style(
'fschild_block_editor_styles',
FSCHILD_THEME_URL .'/css/block-editor-child.css',
array('fs_block_editor_styles'),
FSCHILD_THEME_VERSION,
'screen'
);
}
add_action( 'enqueue_block_editor_assets', 'fschild_block_editor_styles' );
// Gutenberg allowed blocks
function fschild_allowed_blocks() {
wp_enqueue_script(
'byebyeblocks',
FSCHILD_THEME_URL . '/js/byebyeblocks.js',
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ),
FS_THEME_VERSION
);
}
add_action( 'enqueue_block_editor_assets', 'fschild_allowed_blocks' );
function fschild_setup() {
// I18n
load_theme_textdomain( 'the_slug', FSCHILD_THEME_DIR . '/languages' );
// Blocks styles
register_block_style(
'core/image',
array(
'name' => 'noborder',
'label' => esc_attr__( 'No border', 'the_slug' ),
)
);
register_block_style(
'core/image',
array(
'name' => 'circle',
'label' => esc_attr__( 'Circle', 'the_slug' ),
)
);
// global $primary;
// global $secondary;
// global $accent;
// global $bg;
// global $text_color;
//
// add_theme_support( 'editor-font-sizes', array(
// array(
// 'name' => __( 'Small', 'the_slug' ),
// 'size' => 14,
// 'slug' => 'small'
// ),
// array(
// 'name' => __( 'Regular', 'the_slug' ),
// 'size' => 16,
// 'slug' => 'regular'
// ),
// array(
// 'name' => __( 'Medium', 'the_slug' ),
// 'size' => 18,
// 'slug' => 'medium'
// ),
// array(
// 'name' => __( 'Large', 'the_slug' ),
// 'size' => 22,
// 'slug' => 'large'
// ),
// ));
//
// add_theme_support( 'disable-custom-font-sizes' );
//
//
// add_theme_support( 'editor-color-palette', array(
//
// // Customizer colors
//
// array(
// 'name' => esc_html__( 'Primary color', 'the_slug' ),
// 'slug' => 'primary',
// 'color' => $primary,
// ),
// array(
// 'name' => esc_html__( 'Background color', 'the_slug' ),
// 'slug' => 'bg',
// 'color' => $bg,
// ),
// array(
// 'name' => esc_html__( 'White', 'the_slug' ),
// 'slug' => 'white',
// 'color' => '#FFFFFF',
// ),
// array(
// 'name' => esc_html__( 'Text color', 'the_slug' ),
// 'slug' => 'text',
// 'color' => $text_color,
// ),
//
// ));
//
// add_theme_support( 'disable-custom-colors' );
// add_theme_support( 'editor-gradient-presets', [] );
// add_theme_support( 'disable-custom-gradients', true );
//
// add_theme_support( 'editor-gradient-presets', array(
// array(
// 'name' => esc_attr__( 'Light blue to white', 'the_slug' ),
// 'gradient' => 'linear-gradient(180deg, #E3F2F4 50%, #FFFFFF 100%)',
// 'slug' => 'light-blue'
// ),
// array(
// 'name' => esc_attr__( 'Dark blue to black', 'the_slug' ),
// 'gradient' => 'linear-gradient(180deg, #264652 50%, #182C34 100%)',
// 'slug' => 'dark-blue',
// ),
// array(
// 'name' => esc_attr__( 'White and light blue', 'the_slug' ),
// 'gradient' => 'linear-gradient(90deg, #FFFFFF 0%, #FFFFFF 50%, #E3F2F4 50%, #E3F2F4 100%)',
// 'slug' => 'white-blue',
// ),
// ));
}
add_action( 'after_setup_theme', 'fschild_setup' );
// Admin style and script
// add_action('admin_enqueue_scripts', 'fschild_admin_css', 11 );
// function fschild_admin_css() {
// wp_enqueue_style( 'child-admin-css', FSCHILD_THEME_URL . '/css/admin-child.css' );
// }
// Enqueue JS & CSS
function fschild_parent_style() {
if (!is_admin()) {
// Parent's CSS
wp_enqueue_style(
'parent-style',
FS_THEME_URL . '/style.css',
array(),
FS_THEME_VERSION,
'screen'
);
}
}
add_action( 'wp_enqueue_scripts', 'fschild_parent_style' );
function fschild_scripts_load() {
if (!is_admin()) {
// Some Stuff
}
}
add_action( 'wp_enqueue_scripts', 'fschild_scripts_load', PHP_INT_MAX );
// Customizer
//require FSCHILD_THEME_DIR . '/inc/customizer.php';
// CPT
//include_once FSCHILD_THEME_DIR . '/inc/ad-cpt.php';
// ------------------------
// ACF
// ------------------------
if( class_exists('acf') ) {
// Custom blocks
// $my_blocks = array_diff( scandir(FSCHILD_THEME_DIR . '/blocks'), array('..', '.', '.DS_Store') );
//
// foreach( $my_blocks as $block ) {
// include_once 'blocks/'. $block .'/'. $block .'.php';
// include_once 'blocks/'. $block .'/'. $block .'-fields.php';
// }
// Front-End ACF Functions
//
// add_filter('acf/settings/save_json', 'fs_acf_json_save_point');
// function fs_acf_json_save_point( $path ) {
//
// $path = FSCHILD_THEME_DIR . '/inc/acf';
//
// return $path;
// }
// add_filter('acf/settings/load_json', 'fs_acf_json_load_point');
// function fs_acf_json_load_point( $paths ) {
//
// unset($paths[0]);
//
// $paths[] = FSCHILD_THEME_DIR . '/inc/acf';
//
// return $paths;
// }
// ACF Options page
// if (function_exists('acf_add_options_page')) {
//
// add_action( 'init', 'fs_acf_add_options_page' );
// function fs_acf_add_options_page() {
//
// acf_add_options_page(array(
// 'page_title' => esc_html__( 'Site Options', 'the_slug' ),
// 'menu_title' => esc_html__( 'Site Options', 'the_slug' ),
// 'menu_slug' => 'options-site',
// 'capability' => 'edit_posts',
// 'icon_url' => 'dashicons-admin-network',
// 'redirect' => false,
// 'position' => 30
// ));
//
// $parent = acf_add_options_page(array(
// 'page_title' => esc_html__( 'Site Options', 'the_slug' ),
// 'menu_title' => esc_html__( 'Site Options', 'the_slug' ),
// 'menu_slug' => 'options-site',
// 'capability' => 'edit_posts',
// 'icon_url' => 'dashicons-admin-network',
// 'redirect' => 'options-site-partners',
// 'position' => 30
// ));
// acf_add_options_sub_page(array(
// 'page_title' => esc_html__( 'Partners', 'the_slug'),
// 'menu_title' => esc_html__( 'Partners', 'the_slug'),
// 'parent_slug' => $parent['menu_slug'],
// 'menu_slug' => 'options-site-partners'
// ));
// acf_add_options_sub_page(array(
// 'page_title' => esc_html__( 'Program', 'the_slug'),
// 'menu_title' => esc_html__( 'Program', 'the_slug'),
// 'parent_slug' => $parent['menu_slug'],
// 'menu_slug' => 'options-site-program'
// ));
//
// }
// }
}