-
Notifications
You must be signed in to change notification settings - Fork 5
/
functions.php
245 lines (204 loc) · 6.6 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
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
<?php
/**
* Makers Theme Functions & Definations.
*
* @package WordPress
* @subpackage makers
*/
if( ! function_exists( 'makers_setup' ) ) {
/**
* Sets up makers theme defaults and registers theme supports for various WordPress features.
*
*
*/
function makers_setup() {
// initialize theme name
$theme_name = 'makers';
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Twenty-One, use a find and replace
* to change 'makers' to the name of your theme in all the template files.
*/
load_theme_textdomain( $theme_name, get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* This theme does not use a hard-coded <title> tag in the document head,
* WordPress will provide it for us.
*/
add_theme_support( 'title-tag' );
/**
* Add post-formats support.
*/
add_theme_support(
'post-formats',
array(
'link',
'aside',
'gallery',
'image',
'quote',
'status',
'video',
'audio',
'chat',
)
);
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1568, 9999 );
register_nav_menus(
array(
'header' => esc_html__( 'Header Menu', $theme_name ),
'footer' => esc_html__( 'Footer Menu', $theme_name ),
'social_media' => esc_html__( 'Social Media Menu', $theme_name ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
'navigation-widgets',
)
);
/*
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
'unlink-homepage-logo' => true,
) );
/**
* Add support for custom theme header
*/
add_theme_support( 'custom-header', array(
'default-image' => '',
'width' => 1000,
'height' => 250,
'flex-height' => true,
'flex-width' => true,
'uploads' => true,
'random-default' => false,
'header-text' => true,
'default-text-color' => '000',
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
) );
// Custom background color.
add_theme_support( 'custom-background', array(
'default-image' => '',
'default-preset' => 'default',
'default-position-x' => 'left',
'default-position-y' => 'top',
'default-size' => 'auto',
'default-repeat' => 'repeat',
'default-attachment' => 'scroll',
'default-color' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '',
));
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Add support for custom line height controls.
add_theme_support( 'custom-line-height' );
// Add support for experimental link color control.
add_theme_support( 'experimental-link-color' );
// Add support for experimental cover block spacing.
add_theme_support( 'custom-spacing' );
// Remove feed icon link from legacy RSS widget.
add_filter( 'rss_widget_feed_link', '__return_empty_string' );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for Block Editor.
add_theme_support( 'widgets' );
// // Add support for Block Styles.
// add_theme_support( 'wp-block-styles' );
// // Add support for Block Editor.
// add_theme_support( 'widgets-block-editor' );
// remove block widget support
remove_theme_support( 'widgets-block-editor' );
}
}
add_action( 'after_setup_theme', 'makers_setup' );
require_once ("functions/functions-enqueue.php");
require_once ("functions/functions-custom.php");
require_once ("functions/functions-media.php");
require_once ("functions/functions-metabox.php");
require_once ("functions/functions-wpml-languages.php");
require_once ("functions/functions-publish.php");
require_once ("functions/functions-rest-menus.php");
require_once ("functions/functions-rest-filter-fields.php");
require_once ("functions/functions-rest-endpoints.php");
require_once ("functions/functions-rest-register.php");
function my_custom_mime_types($mimes) {
// Creating an array of allowed MIME types
$mimes = array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'glb' => 'model/gltf-binary',
'ttf' => 'font/ttf',
'otf' => 'font/otf'
);
return $mimes;
}
add_filter('upload_mimes', 'my_custom_mime_types');
add_action( 'admin_footer-post-new.php', 'wpse16243_media_default_to_show_all' );
add_action( 'admin_footer-post.php', 'wpse16243_media_default_to_show_all' );
function wpse16243_media_default_to_show_all() {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
var called = 0;
$('#wpcontent').ajaxStop(function() {
if ( 0 === called ) {
$('[value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
called = 1;
}
});
var oldPost = wp.media.view.MediaFrame.Post;
wp.media.view.MediaFrame.Post = oldPost.extend({
browseRouter: function(routerView){
oldPost.prototype.browseRouter.apply(this, arguments);
routerView.set({
upload: {
text: l10n.uploadFilesTitle,
priority: 20
},
browse: {
text: l10n.mediaLibraryTitle,
priority: 40
}
});
},
});
});
</script>
<?php
}
?>