-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
589 lines (499 loc) · 15.8 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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<?php
/***********************************
Theme Setup
***********************************/
function outrisk_resources()
{
//post-formats
add_theme_support('post-formats', array('aside', 'image', 'video', 'gallery', 'quote', 'link'));
//featured images
add_theme_support('post-thumbnails');
add_image_size('full-image', 1200, 675, true);
add_image_size('slider-image', 1400, 500, true);
add_image_size('mckinley-banner', 1400, 200, true);
add_image_size('home-project', 380, 440, true);
add_image_size('news-image', 350, 230, true);
add_image_size('photo-gallery', 260, 200, true);
add_image_size('video-gallery', 360, 250, true);
add_image_size('membership', 380, 300, true);
add_image_size('photo-home', 500, 200, true);
add_image_size('out-team', 200, 200, true);
//navigation menu
add_theme_support('menus');
/* Switch default core markup for search form, comment form, and comments to output valid HTML5. */
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
));
}
add_action('after_setup_theme', 'outrisk_resources');
/************************************
Enqueue scripts and styles
************************************/
function outrisk_scripts()
{
wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css');
wp_enqueue_style('outrisk-steel-css', get_template_directory_uri() . '/css/outrisk.css');
wp_enqueue_style('outrisk-secondary-css', get_template_directory_uri() . '/css/secondary.css');
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_style('slider-css', get_template_directory_uri() . '/css/owl.carousel.min.css');
wp_enqueue_style('navigation-main-css', get_template_directory_uri() . '/css/navigation-main.css', false, '1', 'all');
wp_enqueue_script('jquery-bootstrap', get_theme_file_uri() . '/js/jquery-3.4.1.slim.min.js');
//wp_enqueue_script( 'jquery-bootstrap', get_theme_file_uri() . '/js/jquery-3.2.1.slim.min.js');
wp_enqueue_script('popper-js', get_theme_file_uri() . '/js/popper.min.js');
wp_enqueue_script('bootstrap-js', get_theme_file_uri() . '/js/bootstrap.min.js');
wp_enqueue_script('slider-js', get_theme_file_uri() . '/js/owl.carousel.min.js');
wp_enqueue_script('vanilla-js', get_theme_file_uri() . '/js/script.js');
}
add_action('wp_enqueue_scripts', 'outrisk_scripts');
/************************************
Navigation Menus
************************************/
register_nav_menus(array(
'primary' => __('Primary Menu'),
'products' => __('Products Menu'),
'company' => __('Company Menu'),
'legal' => __('Legal Menu'),
));
/************************************
Slider Post Type
************************************/
function outrisk_slider_post_type()
{
register_post_type(
'Slider',
array(
'labels' => array(
'name' => __('Slider'),
'singular_name' => __('Slider'),
'add_new_item' => 'Add New Slider',
'add_new' => __('Add New Slider'),
'attributes' => __('Slider Attributes', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'slider'
),
'supports' => array(
'title',
'thumbnail'
// 'custom-fields'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-controls-repeat')
)
);
}
add_action('init', 'outrisk_slider_post_type');
// Change Image Editor Library Used by WordPress
// www.wpbeginner.com/wp-tutorials/how-to-fix-the-http-image-upload-error-in-wordpress
function wpb_image_editor_default_to_gd($editors)
{
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff($editors, array($gd_editor));
array_unshift($editors, $gd_editor);
return $editors;
}
add_filter('wp_image_editors', 'wpb_image_editor_default_to_gd');
/************************************
Bread Crumb
************************************/
function get_breadcrumb()
{
echo '<a href="' . home_url() . '" rel="nofollow">Home</a>';
if (is_category() || is_single()) {
echo " » ";
the_category(' • ');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo " » ";
echo the_title();
} elseif (is_search()) {
echo " » Search Results for... ";
echo '"<em>';
echo the_search_query();
echo '</em>"';
}
}
/************************************
Portfolio Slider Post Type
************************************/
function portfolio_slider_post_type()
{
register_post_type(
'Portfoolio Slider',
array(
'labels' => array(
'name' => __('Portfolio Slider'),
'singular_name' => __('Portfolio Slider'),
'add_new_item' => 'Add New Portfolio Slider',
'add_new' => __('Add New Portfolio Slider'),
'attributes' => __('Slider Attributes', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'portfolio_slider'
),
'supports' => array(
'title',
'thumbnail'
// 'custom-fields'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-controls-repeat')
)
);
}
add_action('init', 'portfolio_slider_post_type');
/************************************
Tsetimony Slider Post Type
************************************/
function testimony_slider_post_type()
{
register_post_type(
'Testimonials',
array(
'labels' => array(
'name' => __('Testimonials'),
'singular_name' => __('Testimonials'),
'add_new_item' => 'Add New Testimony',
'add_new' => __('Add New Testimony'),
'attributes' => __('Testimony Attributes', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'testimonials'
),
'supports' => array(
'title',
'thumbnail'
// 'custom-fields'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-controls-repeat')
)
);
}
add_action('init', 'testimony_slider_post_type');
/************************************
Contact-details Post Type
************************************/
function contact_details_post_type()
{
register_post_type(
'Cotact Details',
array(
'labels' => array(
'name' => __('Contact Details'),
'singular_name' => __('Contact Details'),
'add_new_item' => 'Add New Contact Details',
'add_new' => __('Add New Contact Details'),
'attributes' => __('Contact Details Attributes', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'contact_details'
),
'supports' => array(
//'title',
//'thumbnail'
// 'custom-fields'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-controls-repeat')
)
);
}
add_action('init', 'contact_details_post_type');
/************************************
Careers Post Type
************************************/
function careers_post_type()
{
register_post_type(
'Careers',
array(
'labels' => array(
'name' => __('Careers'),
'singular_name' => __('Careers'),
'add_new_item' => 'Add New Careers',
'add_new' => __('Add New Careers'),
'attributes' => __('Careers Attributes', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'careers'
),
'supports' => array(
'title',
// 'thumbnail'
// 'custom-fields'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-controls-repeat')
)
);
}
add_action('init', 'careers_post_type');
/*---------------------------------------*/
function cptui_register_my_cpts_personal_insurance()
{
/**
* Post Type: personal insurance type.
*/
$labels = array(
"name" => __("Personal Insurance", "custom-post-type-ui"),
"singular_name" => __("personal insurance", "custom-post-type-ui"),
);
$args = array(
"label" => __("personal-insurance", "custom-post-type-ui"),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => true,
"rewrite" => array("slug" => "personal-insurance", "with_front" => true),
"query_var" => true,
"supports" => array("title", "editor", "thumbnail", "excerpt"),
"taxonomies" => array("personal_insurance_type"),
'menu_icon' => __('dashicons-businessperson'),
);
register_post_type("personal_insurance", $args);
}
add_action('init', 'cptui_register_my_cpts_personal_insurance');
function cptui_register_my_taxes()
{
/**
* Taxonomy: Personal Insurance Type.
*/
$labels = array(
"name" => __("Personal Insurance Type", "custom-post-type-ui"),
"singular_name" => __("personal insurance type", "custom-post-type-ui"),
);
$args = array(
"label" => __("Personal Insurance Type", "custom-post-type-ui"),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array('slug' => 'personal_insurance_type', 'with_front' => true,),
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "personal_insurance_type",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => false,
);
register_taxonomy("personal_insurance_type", array("personal_insurance"), $args);
}
add_action('init', 'cptui_register_my_taxes');
function cptui_register_my_cpts_business_insurance()
{
/**
* Post Type: business insurance type.
*/
$labels = array(
"name" => __("Business Insurance", "custom-post-type-ui"),
"singular_name" => __("business insurance", "custom-post-type-ui"),
);
$args = array(
"label" => __("business-insurance", "custom-post-type-ui"),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => true,
"rewrite" => array("slug" => "business-insurance", "with_front" => true),
"query_var" => true,
"supports" => array("title", "editor", "thumbnail", "excerpt"),
"taxonomies" => array("business_insurance_type"),
'menu_icon' => __('dashicons-store'),
);
register_post_type("business_insurance", $args);
}
add_action('init', 'cptui_register_my_cpts_business_insurance');
function cptui_register_my_taxess()
{
/**
* Taxonomy: Business Insurance Type.
*/
$labels = array(
"name" => __("Business Insurance Type", "custom-post-type-ui"),
"singular_name" => __("business insurance type", "custom-post-type-ui"),
);
$args = array(
"label" => __("Business Insurance Type", "custom-post-type-ui"),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array('slug' => 'business_insurance_type', 'with_front' => true,),
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "business_insurance_type",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => false,
);
register_taxonomy("business_insurance_type", array("business_insurance"), $args);
}
add_action('init', 'cptui_register_my_taxess');
function cptui_register_my_cpts_motor_insurance()
{
/**
* Post Type: motor insurance type.
*/
$labels = array(
"name" => __("Motor Insurance", "custom-post-type-ui"),
"singular_name" => __("Motor insurance", "custom-post-type-ui"),
);
$args = array(
"label" => __("motor-insurance", "custom-post-type-ui"),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => true,
"rewrite" => array("slug" => "motor-insurance", "with_front" => true),
"query_var" => true,
"supports" => array("title", "editor", "thumbnail", "excerpt"),
"taxonomies" => array("motor_insurance_type"),
'menu_icon' => __('dashicons-car'),
);
register_post_type("motor_insurance", $args);
}
add_action('init', 'cptui_register_my_cpts_motor_insurance');
function cptui_register_my_motor()
{
/**
* Taxonomy: motor Insurance Type.
*/
$labels = array(
"name" => __("Motor Insurance Type", "custom-post-type-ui"),
"singular_name" => __("motor insurance type", "custom-post-type-ui"),
);
$args = array(
"label" => __("Motor Insurance Type", "custom-post-type-ui"),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array('slug' => 'motor_insurance_type', 'with_front' => true,),
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "motor_insurance_type",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => false,
);
register_taxonomy("motor_insurance_type", array("motor_insurance"), $args);
}
add_action('init', 'cptui_register_my_motor');
/************************************
Our Team Post Type
************************************/
function our_team_post_type()
{
register_post_type(
'our-team',
array(
'labels' => array(
'name' => __('Our Team', 'Post Type General Name', 'text_domain'),
'singular_name' => __('Our Team', 'Post Type Singular Name', 'text_domain'),
'menu_name' => __('Our Team', 'text_domain'),
'name_admin_bar' => __('Our Team', 'text_domain'),
'archives' => __('Team Archives', 'text_domain'),
'attributes' => __('our Team Attributes', 'text_domain'),
//'parent_item_colon' => __( 'Parent Leader:', 'text_domain' ),
'all_items' => __('All Team', 'text_domain'),
'add_new_item' => __('Add New Team Member', 'text_domain'),
'add_new' => __('Add New Team Member', 'text_domain'),
'new_item' => __('New Team Member', 'text_domain'),
'edit_item' => __('Edit Team Member', 'text_domain'),
'update_item' => __('Update Team Member', 'text_domain'),
'view_item' => __('View Team Member', 'text_domain'),
'view_items' => __('View Team Members', 'text_domain'),
'search_items' => __('Search for Team Members', 'text_domain'),
'not_found' => __('Team Members Not found', 'text_domain'),
'not_found_in_trash' => __('Team Memebers Not found in Trash', 'text_domain'),
'featured_image' => __('Profile Picture', 'text_domain'),
'set_featured_image' => __('Upload Profile Picture', 'text_domain'),
'remove_featured_image' => __('Remove Profile Picture', 'text_domain'),
'use_featured_image' => __('Use as Profile Picture', 'text_domain'),
'insert_into_item' => __('Insert into Team Member', 'text_domain'),
'uploaded_to_this_item' => __('Uploaded to this Team Member', 'text_domain'),
'items_list' => __('Team Member list', 'text_domain'),
'items_list_navigation' => __('Team Members list navigation', 'text_domain'),
'filter_items_list' => __('Filter Team Members list', 'text_domain'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'our-team'
),
// 'taxonomies' => array(
// 'category'
// ),
'supports' => array(
'title',
'thumbnail'
),
'menu_position' => 5,
'menu_icon' => __('dashicons-admin-users')
)
);
}
add_action('init', 'our_team_post_type');