-
Notifications
You must be signed in to change notification settings - Fork 12
/
functions.php
153 lines (132 loc) · 3.85 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
<?php
/*==================================================
= Starter Theme Introduction =
==================================================*/
/**
*
* About Starter
* --------------
* Starter is a project by Calvin Koepke to create a starter theme for Genesis Framework developers that doesn't over-bloat
* their starting base. It includes commonly used templates, codes, and styles, along with optional SCSS and Gulp tasking.
*
* Credits and Licensing
* --------------
* Starter was created by Calvin Koepke, and is under GPL 2.0+.
*
* Find me on Twitter: @cjkoepke
*
*/
/*============================================
= Begin Functions File =
============================================*/
/**
*
* Define Child Theme Constants
*
* @since 1.0.0
*
*/
define( 'CHILD_THEME_NAME', 'Starter Theme' );
define( 'CHILD_THEME_AUTHOR', 'Calvin Koepke' );
define( 'CHILD_THEME_AUTHOR_URL', 'https://calvinkoepke.com/' );
define( 'CHILD_THEME_URL', 'http://startertheme.io' );
define( 'CHILD_THEME_VERSION', '1.1.0' );
define( 'TEXT_DOMAIN', 'startertheme' );
/**
*
* Start the engine
*
* @since 1.0.0
*
*/
include_once( get_template_directory() . '/lib/init.php');
/**
*
* Load files in the /assets/ directory
*
* @since 1.0.0
*
*/
add_action( 'wp_enqueue_scripts', 'startertheme_load_assets' );
function startertheme_load_assets() {
// Load fonts.
wp_enqueue_style( 'startertheme-fonts', '//fonts.googleapis.com/css?family=Lato:400,700,700italic', array(), CHILD_THEME_VERSION );
// Load JS.
wp_enqueue_script( 'startertheme-global', get_stylesheet_directory_uri() . '/build/js/global.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
// Load default icons.
wp_enqueue_style( 'dashicons' );
// Load responsive menu.
$suffix = defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script( 'startertheme-responsive-menu', get_stylesheet_directory_uri() . '/build/js/responsive-menus' . $suffix . '.js', array( 'jquery', 'startertheme-global' ), CHILD_THEME_VERSION, true );
wp_localize_script(
'startertheme-responsive-menu',
'genesis_responsive_menu',
starter_get_responsive_menu_args()
);
}
/**
* Set the responsive menu arguments.
*
* @return array Array of menu arguments.
*
* @since 1.1.0
*/
function starter_get_responsive_menu_args() {
$args = array(
'mainMenu' => __( 'Menu', TEXT_DOMAIN ),
'menuIconClass' => 'dashicons-before dashicons-menu',
'subMenu' => __( 'Menu', TEXT_DOMAIN ),
'subMenuIconClass' => 'dashicons-before dashicons-arrow-down-alt2',
'menuClasses' => array(
'combine' => array(
'.nav-primary',
'.nav-header',
'.nav-secondary',
),
'others' => array(
'.nav-footer',
'.nav-sidebar',
),
),
);
return $args;
}
/**
*
* Add theme supports
*
* @since 1.0.0
*
*/
add_theme_support( 'genesis-responsive-viewport' ); /* Enable Viewport Meta Tag for Mobile Devices */
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); /* HTML5 */
add_theme_support( 'genesis-accessibility', array( 'skip-links', 'search-form', 'drop-down-menu', 'headings' ) ); /* Accessibility */
add_theme_support( 'genesis-after-entry-widget-area' ); /* After Entry Widget Area */
add_theme_support( 'genesis-footer-widgets', 3 ); /* Add Footer Widgets Markup for 3 */
/**
*
* Apply custom body classes
*
* @since 1.0.0
* @uses /lib/classes.php
*
*/
include_once( get_stylesheet_directory() . '/lib/classes.php' );
/**
*
* Apply Starter Theme defaults (overrides default Genesis settings)
*
* @since 1.0.0
* @uses /lib/defaults.php
*
*/
include_once( get_stylesheet_directory() . '/lib/defaults.php' );
/**
*
* Apply Starter Theme default attributes
*
* @since 1.0.0
* @uses /lib/attributes.php
*
*/
include_once( get_stylesheet_directory() . '/lib/attributes.php' );