-
Notifications
You must be signed in to change notification settings - Fork 143
/
functions.php
194 lines (171 loc) · 5.56 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
<?php
/**
* Gather all bits and pieces together.
* If you end up having multiple post types, taxonomies,
* hooks and functions - please split those to their
* own files under /inc and just require here.
*
* @Date: 2019-10-15 12:30:02
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2024-01-10 18:54:48
*
* @package air-light
*/
namespace Air_Light;
/**
* The current version of the theme.
*/
define( 'AIR_LIGHT_VERSION', '9.4.6' );
// We need to have some defaults as comments or empties so let's allow this:
// phpcs:disable Squiz.Commenting.InlineComment.SpacingBefore, WordPress.Arrays.ArrayDeclarationSpacing.SpaceInEmptyArray
/**
* Theme settings
*/
add_action( 'after_setup_theme', function() {
$theme_settings = [
/**
* Theme textdomain
*/
'textdomain' => 'air-light',
/**
* Content width
*/
'content_width' => 800,
/**
* Logo and featured image
*/
'default_featured_image' => null,
'logo' => '/svg/logo.svg',
/**
* Custom setting group settings when using Air setting groups plugin.
* On multilingual sites using Polylang, translations are handled automatically.
*/
'custom_settings' => [
// 'your-custom-setting' => [
// 'id' => Your custom setting post id,
// 'title' => 'Your custom setting',
// 'block-editor' => true,
// ],
],
'social_media_accounts' => [
// 'twitter' => [
// 'title' => 'Twitter',
// 'url' => 'https://twitter.com/digitoimistodude',
// ],
],
/**
* All links are checked with JS, if those direct to external site and if,
* indicator of that is included. Exclude domains from that check in this array.
*/
'external_link_domains_exclude' => [
'localhost:3000',
'airdev.test',
'airwptheme.com',
'localhost',
],
/**
* Menu locations
*/
'menu_locations' => [
'primary' => __( 'Primary Menu', 'air-light' ),
],
/**
* Taxonomies
*
* See the instructions:
* https://github.com/digitoimistodude/air-light#custom-taxonomies
*/
'taxonomies' => [
// 'Your_Taxonomy' => [ 'post', 'page' ],
],
/**
* Post types
*
* See the instructions:
* https://github.com/digitoimistodude/air-light#custom-post-types
*/
'post_types' => [
// 'Your_Post_Type',
],
/**
* Gutenberg -related settings
*/
// Register custom ACF Blocks
'acf_blocks' => [
// [
// 'name' => 'block-file-slug',
// 'title' => 'Block Visible Name',
// // You can safely remove lines below if you find no use for them
// 'prevent_cache' => false, // Defaults to false,
// // Icon defaults to svg file inside svg/block-icons named after the block name,
// // eg. svg/block-icons/block-file-slug.svg
// //
// // Icon setting defines the dashicon equivalent: https://developer.wordpress.org/resource/dashicons/#block-default
// // 'icon' => 'block-default',
// ],
],
// Custom ACF block default settings
'acf_block_defaults' => [
'category' => 'air-light',
'mode' => 'auto',
'align' => 'full',
'post_types' => [
'page',
],
'supports' => [
'align' => false,
'anchor' => true,
'customClassName' => false,
],
'render_callback' => __NAMESPACE__ . '\render_acf_block',
],
// Restrict to only selected blocks
//
// Options: 'none', 'all', 'all-core-blocks', 'all-acf-blocks',
// or any specific block or a combination of these
// Accepts both string (all*/none-options only) and array (options + specific blocks)
'allowed_blocks' => [
'post' => 'all-core-blocks',
'page' => [],
// 'page' => [
// 'all-acf-blocks',
// 'core/paragraph',
// ],
// 'post-type' => [
// 'acf/content-image',
// 'core/paragraph',
// ],
// 'example' => [
// 'all-core-blocks',
// 'acf/content-image',
// ],
],
// If you want to use classic editor somewhere, define it here
'use_classic_editor' => [],
// Add your own settings and use them wherever you need, for example THEME_SETTINGS['my_custom_setting']
'my_custom_setting' => true,
];
$theme_settings = apply_filters( 'air_light_theme_settings', $theme_settings );
define( 'THEME_SETTINGS', $theme_settings );
} ); // end action after_setup_theme
/**
* Required files
*/
require get_theme_file_path( '/inc/hooks.php' );
require get_theme_file_path( '/inc/includes.php' );
require get_theme_file_path( '/inc/template-tags.php' );
// Run theme setup
add_action( 'after_setup_theme', __NAMESPACE__ . '\theme_setup' );
add_action( 'after_setup_theme', __NAMESPACE__ . '\build_theme_support' );
/*
* First: we register the taxonomies and post types after setup theme
* If air-helper loads (for translations), we unregister the original taxonomies and post types
* and reregister them with the translated ones.
*
* This allows the slugs translations to work before the translations are available,
* and for the label translations to work if they are available.
*/
add_action( 'after_setup_theme', __NAMESPACE__ . '\build_taxonomies' );
add_action( 'after_setup_theme', __NAMESPACE__ . '\build_post_types' );
add_action( 'after_air_helper_init', __NAMESPACE__ . '\rebuild_taxonomies' );
add_action( 'after_air_helper_init', __NAMESPACE__ . '\rebuild_post_types' );