This repository was archived by the owner on Jul 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·299 lines (218 loc) · 7.84 KB
/
functions.php
File metadata and controls
executable file
·299 lines (218 loc) · 7.84 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<?php
/**
* Set the default content width based on the theme's design and stylesheet.
* This defaults to Bootstrap's Large devices breakpoint (large desktops, 1200px and up)
*
* As far as I can tell, WordPress uses this when setting the width and height for embeded media (iframes, YouTube, etc.) that is inserted
* into the content area of posts/pages.
*/
// $content_width = 1170;
/**
* @todo Document me.
*/
// $monk_default_media_ratio = 9/16; // Standard widescreen ratio.
/**
* Generally used to initialize theme settings/options.
* This is the first action hook available to themes, triggered immediately after the active theme's functions.php file is loaded.
* At this stage, the current user is NOT yet authenticated.
*/
function monk_setup(){
global $content_width, $monk_default_media_ratio;
/*
* Define the default thumbnail size for this project. If left uncommented, the default size will be calculated based on the values of
* $content_width and $monk_default_media_ratio.
*/
// set_post_thumbnail_size($width, $height, $crop);
/**
* Additional image sizes
*/
add_image_size('full-width', $content_width, round($content_width * $monk_default_media_ratio), true);
// add_image_size($name, $width, $height, $crop);
/**
* Define menus for this project. If support for 'monk-default-nav-menu' is declared then the default nav menu 'primary' will also be set unless
* it is already defined below.
*/
//register_nav_menus(array( /* define your menu locations here */ ));
register_nav_menus([
'primary' => __('Menu Menu'),
'secondary' => __('Footer Menu'),
'social' => __('Social Menu')
]);
}
add_action('after_setup_theme', "monk_setup");
/**
* Typically used by plugins to initialize. The current user is ALREADY authenticated by this time.
*/
function monk_init(){
/** feature support for post types */
/**
* Add excerpt fields to pages
*/
//add_post_type_support('page', 'excerpt');
}
add_action('init', 'monk_init');
/**
* wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end.
* Despite the name, it is used for enqueuing both scripts and styles.
*/
function monk_enqueue_assets(){
if(WP_ENV === 'development') { // Add assets here that are only to be loaded in during development stage.
}else{ // Add assets here that are only to be loaded in during production.
}
// Global assets can be placed here...
wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js');
}
add_action('wp_enqueue_scripts', 'monk_enqueue_assets');
/**
* @see https://www.advancedcustomfields.com/add-ons/options-page/
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
/** DEFINE SUPPORT FOR CORE WORDPRESS FEATURES **
* This section is where we define support for features that we want to use for this project.
*/
/**
* Add default posts and comments RSS feed links to head.
*/
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails (aka. 'Feature Images' ).
*
* See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
//'aside',
//'image',
//'video',
//'quote',
//'link',
//'gallery',
//'status',
//'audio',
//'chat',
) );
/** DEFINE SUPPORT FOR MONK FEATURES **/
// Add support for Bootstrap's Thumbnail Component to galleries
add_theme_support( 'bootstrap-gallery' );
/**
* Enable cache-busting.
*
* WARNING!: the required rewrite rules MUST BE IN PLACE in the .htaccess file!
*
* If you're not using a build process to manage your filename version
* revving, you might want to consider enabling the following theme support
* to route all requests such as `/style.422.css` to `/style.css`.
*
* To understand why this is important and even a better solution than
* using something like `*.css?ver=4.0.0`, please see:
* http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
*/
add_theme_support( 'monk-cache-busting' );
/**
* If declared, the theme will register sidebars with the ID 'sidebar'. More than one can be registered by passing the second argument.
*/
//add_theme_support('monk-sidebar-widgets', 1);
/**
* If declared, the theme will register sidebars that are expected to be loaded in the site's footer.
*/
//add_theme_support('monk-footer-widgets',3);
/**
* Let the theme automatically create a menu called, which will be given the name 'primary'.
* If this is not declared then you'll have to define menus for this project yourself within the monk_setup() function below.
*/
add_theme_support("monk-default-nav-menu");
/**
*
*/
add_theme_support('monk-base-template');
/**
*
*/
add_theme_support('monk-email-encrypt');
/**
* Coming soon...
* Don't enable this, will probably break site!
*/
// add_theme_support('monk-page-hooks');
/** DEFINE SUPPORT FOR SOIL PLUGIN FEATURES **
* NOTE: Some of these features are also included in Monk\Config
*/
/**
* Cleaner WordPress markup
*/
add_theme_support('soil-clean-up');
/**
* Disable asset versioning
*/
ON_MONK && add_theme_support('soil-disable-asset-versioning');
/**
* Disable trackbacks
*/
add_theme_support('soil-disable-trackbacks');
/**
* Google Analytics ([more info](https://github.com/roots/soil/wiki/Google-Analytics))
*
* This is probably never needed since the SEO plugin we usually use also provides this functionality
*
*/
//add_theme_support('soil-google-analytics', 'UA-XXXXX-Y');
/**
* Load jQuery from the jQuery CDN
*
* WARNING: Currently this is not compatible with monk3's Asset Component Manager and will cause jQuery (and subsequently all it's dependencies)
* to fail to load altogether.
*/
//add_theme_support('soil-jquery-cdn');
/**
* Move all JS to the footer
*/
// add_theme_support('soil-js-to-footer');
/**
* Cleaner walker for navigation menus
*
* Basically conforms WordPres' nav menu to Bootstrap's Navbar structure.
*/
add_theme_support('soil-nav-walker');
/**
* Convert search results from `/?s=query` to `/search/query/
*/
add_theme_support('soil-nice-search');
/**
* Root relative URLs
*
* Creates relative URIs for images and links rather than absolute paths that contain the server name.
*/
add_theme_support('soil-relative-urls');
/** LOAD CORE INCLUDES **/
/**
* For the most part you can ignore this section.
*/
foreach ( [
'includes/utils', // Utility & helper functions
'includes/setup', // Initial theme setup and constants
'includes/router', // Setup the Template Router API
'includes/slider', // Load Slider API class
'includes/partial', // Partial Manager Class
'includes/assets', // Asset component manager for wiring scripts, stylesheets and their dependencies.
'includes/config', // Configure theme functionality
'includes/nav', // Custom nav walkers
'includes/forms', // Custom overrides for popular form plugins
'includes/galleries', // Custom galleries
'includes/template-tags', // Arbitary template tags
'includes/shortcodes' // Theme shortcodes
] as $file) if(!locate_template("$file.php", true, true))
trigger_error ( sprintf( __( 'Error locating %s.php for inclusion.'), $file ) , E_USER_ERROR);