-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathfunctions.php
200 lines (145 loc) · 5.64 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
<?php
/**
* Theme Setup
* @since 1.0.0
*
* This setup function attaches all of the site-wide functions
* to the correct hooks and filters. All the functions themselves
* are defined below this setup function.
*
*/
add_action( 'genesis_setup','child_theme_setup', 15 );
function child_theme_setup() {
/****************************************
Define child theme version
*****************************************/
define( 'CHILD_THEME_VERSION', filemtime( get_stylesheet_directory() . '/style.css' ) );
/****************************************
Include theme helper functions
*****************************************/
include_once( CHILD_DIR . '/lib/theme-helpers.php' );
/****************************************
Setup child theme functions
*****************************************/
include_once( CHILD_DIR . '/lib/theme-functions.php' );
/****************************************
Backend
*****************************************/
// Image Sizes
// add_image_size( $name, $width = 0, $height = 0, $crop = false );
// Clean up Head
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
// Structural Wraps
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'inner',
'footer-widgets',
'footer'
) );
// Unregister Secondary Nav Menu
add_theme_support( 'genesis-menus', array(
'primary' => 'Primary Navigation Menu'
) );
// Sidebars
unregister_sidebar( 'sidebar-alt' );
genesis_register_sidebar( array(
'name' => 'Footer',
'id' => 'custom-footer'
) );
//add_theme_support( 'genesis-footer-widgets', 4 );
// Execute shortcodes in widgets
// add_filter( 'widget_text', 'do_shortcode' );
// Remove Unused Page Layouts
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
// Remove Unused User Settings
// remove_action( 'show_user_profile', 'genesis_user_options_fields' );
// remove_action( 'edit_user_profile', 'genesis_user_options_fields' );
// remove_action( 'show_user_profile', 'genesis_user_archive_fields' );
// remove_action( 'edit_user_profile', 'genesis_user_archive_fields' );
// remove_action( 'show_user_profile', 'genesis_user_seo_fields' );
// remove_action( 'edit_user_profile', 'genesis_user_seo_fields' );
// remove_action( 'show_user_profile', 'genesis_user_layout_fields' );
// remove_action( 'edit_user_profile', 'genesis_user_layout_fields' );
// Editor Styles
add_editor_style( 'editor-style.css' );
// Remove Genesis Theme Settings Metaboxes
add_action( 'genesis_theme_settings_metaboxes', 'mb_remove_genesis_metaboxes' );
// Reposition Genesis Layout Settings Metabox
remove_action( 'admin_menu', 'genesis_add_inpost_layout_box' );
add_action( 'admin_menu', 'mb_add_inpost_layout_box' );
// Setup Child Theme Settings
include_once( CHILD_DIR . '/lib/child-theme-settings.php' );
// Prevent File Modifications
define ( 'DISALLOW_FILE_EDIT', true );
// Set Content Width
$content_width = apply_filters( 'content_width', 740, 740, 1140 );
// Add support for custom background
add_theme_support( 'custom-background' );
// Add support for custom header
add_theme_support( 'genesis-custom-header', array(
'width' => 960,
'height' => 80
) );
// Remove Dashboard Meta Boxes
add_action( 'wp_dashboard_setup', 'mb_remove_dashboard_widgets' );
// Change Admin Menu Order
add_filter( 'custom_menu_order', 'mb_custom_menu_order' );
add_filter( 'menu_order', 'mb_custom_menu_order' );
// Hide Admin Areas that are not used
add_action( 'admin_menu', 'mb_remove_menu_pages' );
// Remove default link for images
add_action( 'admin_init', 'mb_imagelink_setup', 10 );
// Define custom post type capabilities for use with Members
// add_action( 'admin_init', 'mb_add_post_type_caps' );
/****************************************
Frontend
*****************************************/
// Add HTML5 markup structure
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
'caption',
) );
// Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
// Load Apple touch icon in header
add_action( 'wp_head', 'mb_apple_touch_icon', 9 );
// Remove Edit link
add_filter( 'genesis_edit_post_link', '__return_false' );
// Footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'mb_footer' );
// Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'mb_scripts' );
// Remove Query Strings From Static Resources
add_filter( 'script_loader_src', 'mb_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', 'mb_remove_script_version', 15, 1 );
// Remove Read More Jump
add_filter( 'the_content_more_link', 'mb_remove_more_jump_link' );
/****************************************
Theme Views
*****************************************/
include_once( CHILD_DIR . '/lib/theme-views.php' );
/****************************************
Require Plugins
*****************************************/
require_once( CHILD_DIR . '/lib/class-tgm-plugin-activation.php' );
require_once( CHILD_DIR . '/lib/theme-require-plugins.php' );
add_action( 'tgmpa_register', 'mb_register_required_plugins' );
}
/****************************************
Misc Theme Functions
*****************************************/
// Unregister the superfish scripts
add_action( 'custom_disable_superfish', 'mb_unregister_superfish' );
// Filter Yoast SEO Metabox Priority
add_filter( 'wpseo_metabox_prio', 'mb_filter_yoast_seo_metabox' );