This repository was archived by the owner on Jun 5, 2025. It is now read-only.
forked from powerbuoy/sleek
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·160 lines (139 loc) · 4.97 KB
/
functions.php
File metadata and controls
executable file
·160 lines (139 loc) · 4.97 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
<?php
########
# Vendor
require __DIR__ . '/vendor/autoload.php';
###################
# Load translations
load_theme_textdomain('sleek', get_template_directory() . '/dist/lang/');
load_theme_textdomain('sleek_admin', get_template_directory() . '/dist/lang/admin/');
################
# Sleek settings
add_theme_support('sleek/classic_editor');
add_theme_support('sleek/jquery_cdn');
add_theme_support('sleek/disable_jquery');
add_theme_support('sleek/disable_404_guessing');
# add_theme_support('sleek/nice_email_from'); NOTE: This overrides whatever from is set in CF7 so don't use probably
add_theme_support('sleek/disable_theme_editor');
# add_theme_support('sleek/get_terms_post_type_arg');
add_theme_support('sleek/acf/hide_admin');
# add_theme_support('sleek/acf/fields/redirect_url');
# add_theme_support('sleek/archive_filter');
add_theme_support('sleek/cleanup/comment_form_placeholders');
# add_theme_support('sleek/cleanup/disable_comments');
# add_theme_support('sleek/gallery/slideshow'); # Convert galleries to slideshows
add_theme_support('sleek/oembed/responsive_video'); # Adds div.video around embeds
# add_theme_support('sleek/oembed/data_src'); # Replaces src attributes with data-src - use together with sleek-ui/vide-embed
# add_theme_support('sleek/login/styling');
# add_theme_support('sleek/login/require_login');
# add_theme_support('sleek/modules/module_preview'); # NOTE: Alpha
# add_theme_support('sleek/modules/inline_edit'); # NOTE: Alpha
add_theme_support('sleek/modules/add_new_module_preview');
add_theme_support('sleek/modules/module_icons');
add_theme_support('sleek/modules/global_modules');
add_theme_support('sleek/notices/outdated_browser_warning');
# add_theme_support('sleek/notices/cookie_consent');
add_theme_support('sleek/tinymce/disable_colors');
add_theme_support('sleek/tinymce/clean_paste');
#############
# Image sizes
Sleek\ImageSizes\register(1920, 1080, ['center', 'center']/*, [
'original' => ['width' => 1920, 'height' => 9999, 'crop' => false],
'portrait' => ['width' => 1080, 'height' => 1920, 'crop' => ['center', 'top']],
'square' => ['width' => 1920, 'height' => 1920],
]*/);
#######
# Menus
register_nav_menus([
'header_menu' => __('Header menu', 'sleek_admin'),
'footer_menu' => __('Footer menu', 'sleek_admin')
]);
################
# Sleek settings
/* add_action('admin_init', function () {
Sleek\Settings\add_setting('hubspot_portal_id', 'text', __('Hubspot Portal ID', 'sleek'));
Sleek\Settings\add_setting('hubspot_api_key', 'text', __('Hubspot API Key', 'sleek'));
});
# ... use them
add_action('wp_head', function () {
if ($portalId = Sleek\Settings\get_setting('hubspot_portal_id')) {
echo '<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/' . $portalId . '.js"></script>';
}
}); */
############
# ACF fields
add_action('acf/init', function () {
# Site Settings Page
/* acf_add_options_page([
'page_title' => __('Site Settings', 'sleek'),
'menu_slug' => 'site_settings',
'post_id' => 'site_settings'
]); */
# Site Setting Fields
/* acf_add_local_field_group([
'key' => 'site_settings',
'title' => __('Site Settings', 'sleek'),
'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'site_settings']]],
'menu_order' => 0,
'fields' => [
[
'key' => 'site_settings_message',
'name' => 'message',
'type' => 'message',
'label' => __('Nothing here', 'sleek'),
'message' => __('Nothing here yet.', 'sleek')
]
]
]); */
# Sidebar Modules
/* acf_add_local_field_group([
'key' => 'group_sidebar_modules',
'title' => __('Sidebar Modules', 'sleek'),
'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'site_settings']]],
'menu_order' => 1,
'fields' => [
[
'key' => 'sidebar_modules',
'name' => 'sidebar_modules',
'type' => 'flexible_content',
'label' => __('Sidebar Modules', 'sleek'),
'button_label' => __('Add a module', 'sleek'),
'layouts' => Sleek\Acf\generate_keys(
Sleek\Modules\get_module_fields([
'text-block' # Add more modules as needed
], 'flexible'),
'sidebar_modules'
)
]
]
]); */
# Make site settings translatable
/* add_filter('acf/validate_post_id', function ($postId) {
if ($postId == 'site_settings') {
$dl = acf_get_setting('default_language');
$cl = acf_get_setting('current_language');
if ($cl and $cl !== $dl) {
$postId .= '_' . $cl;
}
}
return $postId;
}); */
});
##################################
# Add common fields to all modules
/* add_filter('sleek/modules/fields', function ($fields, $module) {
# Add background image to these modules
if (in_array($module, ['text-block', 'text-blocks'])) {
array_unshift($fields, [
'name' => 'background_color',
'label' => __('Background Color', 'sleek'),
'type' => 'select',
'choices' => [
'transparent' => __('Transparent', 'sleek'),
'light' => __('Light', 'sleek'),
'dark' => __('Dark', 'sleek')
],
'default_value' => 'transparent'
]);
}
return $fields;
}, 10, 2); */