-
Notifications
You must be signed in to change notification settings - Fork 24
/
functions.php
executable file
·145 lines (125 loc) · 4.63 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
<?php
########
# Vendor
require __DIR__ . '/vendor/autoload.php';
#####
# Inc
# NOTE: These are optional examples, currently only used by the invise-example-module
require __DIR__ . '/inc/invise-module.php';
require __DIR__ . '/inc/module-class.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_admin'));
Sleek\Settings\add_setting('hubspot_api_key', 'text', __('Hubspot API Key', 'sleek_admin'));
});
# ... 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_admin'),
'menu_slug' => 'site_settings',
'post_id' => 'site_settings'
]); */
# Site Setting Fields
/* acf_add_local_field_group([
'key' => 'site_settings',
'title' => __('Site Settings', 'sleek_admin'),
'location' => [[['param' => 'options_page', 'operator' => '==', 'value' => 'site_settings']]],
'menu_order' => 0,
'fields' => [
[
'key' => 'site_settings_message',
'name' => 'message',
'type' => 'message',
'label' => __('Nothing here', 'sleek_admin'),
'message' => __('Nothing here yet.', 'sleek_admin')
]
]
]); */
# Sidebar Modules
/* acf_add_local_field_group([
'key' => 'group_sidebar_modules',
'title' => __('Sidebar Modules', 'sleek_admin'),
'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_admin'),
'button_label' => __('Add a module', 'sleek_admin'),
'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;
}); */
});