-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
187 lines (145 loc) · 6.42 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
<?php
// Start the engine
include_once( get_template_directory() . '/lib/init.php' );
// Setup Theme
include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
// Set Localization (do not remove)
load_child_theme_textdomain( 'mobile-first-sass', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'mobile-first-sass' ) );
// Add Image upload and Color select to WordPress Theme Customizer
require_once( get_stylesheet_directory() . '/lib/customize.php' );
// Include Customizer CSS
include_once( get_stylesheet_directory() . '/lib/output.php' );
// Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'GenesisThe.me Developer Starter' );
define( 'CHILD_THEME_URL', 'https://www.genesisthe.me/' );
define( 'CHILD_THEME_VERSION', '1.0.6' );
// Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'mobile_first_sass_scripts_styles' );
function mobile_first_sass_scripts_styles() {
wp_enqueue_style( 'dashicons' );
wp_enqueue_script( 'mobile-first-sass-responsive-menu', get_stylesheet_directory_uri() . '/js/min/responsive-menu.min.js', array( 'jquery' ), '1.0.0', true );
$output = array(
'mainMenu' => __( 'Menu', 'mobile-first-sass' ),
'subMenu' => __( 'Menu', 'mobile-first-sass' ),
'headerMenu' => __( 'Menu', 'mobile-first-sass' ),
);
wp_localize_script( 'mobile-first-sass-responsive-menu', 'mobileFirstSassL10n', $output );
// Because who wants Superfish?
// wp_deregister_script( 'superfish' );
// wp_deregister_script( 'superfish-args' );
$version = defined( 'CHILD_THEME_VERSION' ) && CHILD_THEME_VERSION ? CHILD_THEME_VERSION : PARENT_THEME_VERSION;
$handle = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'child-theme';
wp_enqueue_style( $handle, get_stylesheet_directory_uri() . '/style.min.css', false, $version);
wp_enqueue_style( 'fonts', 'https://fonts.googleapis.com/css?family=Montserrat:600|Open+Sans' );
}
// De-register uncompressed stylesheet - minified loaded above
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
// Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) );
// Add Accessibility support
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
// Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
// Deregister WP 4.2 Emoji support
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
// Add support for custom header
add_theme_support( 'custom-header', array(
'width' => 484,
'height' => 76,
'header-selector' => '.site-title a',
'header-text' => false,
'flex-height' => true,
) );
// Add support for custom background
add_theme_support( 'custom-background' );
// Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );
// Register header navigation menu
register_nav_menu( 'header', __( 'Header Menu', 'genesis-header-nav' ) );
// Rename primary and secondary navigation menus
add_theme_support( 'genesis-menus' , array(
'primary' => __( 'After Header Menu', 'mobile-first-sass' ),
'secondary' => __( 'Footer Menu', 'mobile-first-sass' ) ) );
// Maybe move the primary navigation to the header (if no widget in header-right)
// add_action( 'genesis_before', 'move_primary_nav_if_no_header_widget' );
// function move_primary_nav_if_no_header_widget() {
// if ( is_active_sidebar( 'header-right' ) ) {
// return;
// }
// remove_action( 'genesis_after_header', 'genesis_do_nav' );
// add_action( 'genesis_header', 'genesis_do_nav', 13 );
// }
// Display header navigation menu (via @GaryJ Genesis Header Nav plugin)
add_action( 'genesis_header', 'show_menu' );
apply_filters( 'genesis_header_nav_priority', 12 );
function show_menu() {
$class = 'menu genesis-nav-menu menu-header';
if ( genesis_superfish_enabled() ) {
$class .= ' js-superfish';
}
genesis_nav_menu(
array(
'theme_location' => 'header',
'menu_class' => $class,
)
);
}
/**
* Add ID/aria label to secondary navigation.
* @param $attributes
*
* @return mixed
*/
add_filter( 'genesis_attr_nav-header', 'mobile_first_sass_add_nav_header_id' );
function mobile_first_sass_add_nav_header_id( $attributes ) {
$attributes['id'] = 'menu-header-navigation';
$attributes['aria-label'] = __( 'Header navigation', 'mobile-first-sass' );
return $attributes;
}
add_filter( 'genesis_skip_links_output', 'mobile_first_sass_add_nav_header_skip_link' );
/**
* Add the header navigation menu to the skip links output.
* @param $links
*
* @return array
*/
function mobile_first_sass_add_nav_header_skip_link( $links ) {
$new_links = $links;
array_splice( $new_links, 1 );
if ( has_nav_menu( 'header' ) ) {
$new_links['menu-header-navigation'] = __( 'Skip to header navigation', 'mobile-first-sass' );
}
return array_merge( $new_links, $links );
}
// Reposition the secondary navigation menu to footer, if wanted
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_footer', 'genesis_do_subnav', 5 );
// Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
// Remove site layouts
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
// Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'mobile_first_sass_remove_comment_form_allowed_tags' );
function mobile_first_sass_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
// Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'mobile_first_sass_author_box_gravatar' );
function mobile_first_sass_author_box_gravatar( $size ) {
return 90;
}
// Modify the size of the Gravatar in the entry comments
add_filter( 'genesis_comment_list_args', 'mobile_first_sass_comments_gravatar' );
function mobile_first_sass_comments_gravatar( $args ) {
$args['avatar_size'] = 60;
return $args;
}
// Register widget areas
// As you wish...