-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·102 lines (87 loc) · 3.03 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
<?php
/**
* Quotes on Dev Theme functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package QOD_Starter_Theme
*/
if (!function_exists('qod_setup')) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function qod_setup()
{
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
// Let WordPress manage the document title.
add_theme_support('title-tag');
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array(
'primary' => esc_html('Primary Menu'),
));
// Switch search form, comment form, and comments to output valid HTML5.
add_theme_support('html5', array('search-form'));
}
endif; // qod_setup
add_action('after_setup_theme', 'qod_setup');
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* @global int $content_width
*/
function qod_content_width()
{
$GLOBALS['content_width'] = apply_filters('qod_content_width', 640);
}
add_action('after_setup_theme', 'qod_content_width', 0);
/**
* Filter the stylesheet_uri to output the minified CSS file.
*/
function qod_minified_css($stylesheet_uri, $stylesheet_dir_uri)
{
if (file_exists(get_template_directory() . '/build/css/style.min.css')) {
$stylesheet_uri = $stylesheet_dir_uri . '/build/css/style.min.css';
}
return $stylesheet_uri;
}
add_filter('stylesheet_uri', 'qod_minified_css', 10, 2);
/**
* Enqueue scripts and styles.
*/
function qod_scripts()
{
// Add Styles to Header
wp_enqueue_style('qod-style', get_stylesheet_uri());
wp_enqueue_style('qod-font', 'https://fonts.googleapis.com/css?family=Exo:300,300i,400,400i,500,500i&display=swap');
// Add Scripts to Header
wp_enqueue_script('jquery');
wp_enqueue_script('qod-script', get_template_directory_uri() . '/build/js/qod.min.js', array('jquery'), '', true);
wp_enqueue_script('font-awesome', 'https://use.fontawesome.com/99845e9ab8.js');
// Localize a chosen Global JavaScript object
wp_localize_script('qod-script', 'qod_api', array(
'rest_url' => esc_url_raw(rest_url()), // Wp-JSon
'wpapi_nonce' => wp_create_nonce('wp_rest'), // Authenticate
'post_id' => get_the_ID(),
'home_url' => esc_url_raw(home_url()) // Link to home url
));
wp_enqueue_script('qod-starter-navigation', get_template_directory_uri() . '/build/js/navigation.min.js', array(), '20151215', true);
wp_enqueue_script('qod-starter-skip-link-focus-fix', get_template_directory_uri() . '/build/js/skip-link-focus-fix.min.js', array(), '20151215', true);
}
add_action('wp_enqueue_scripts', 'qod_scripts');
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom metaboxes generated using the CMB2 library.
*/
require get_template_directory() . '/inc/metaboxes.php';
/**
* Custom WP API modifications.
*/
require get_template_directory() . '/inc/api.php';