-
Notifications
You must be signed in to change notification settings - Fork 44
/
functions.php
executable file
·149 lines (125 loc) · 4.58 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
<?php
/**
* Functions
*
* @package JB_Genesis_Child
* @since 1.0.0
* @link https://www.jbrownstudios.com
* @author Jon Brown <[email protected]>
* @attribution Bill Erickson <[email protected]>
* @copyright Copyright (c) 2012, Jon Brown
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @attribution Child theme based on the work of Bill Erickson https://github.com/billerickson/BE-Genesis-Child
*/
/**
* 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() {
// ** Backend **
// Image Sizes
// add_image_size( 'be_featured', 400, 100, true );
// Structural Wraps
add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'footer-widgets', 'footer' ) );
// Menus
add_theme_support( 'genesis-menus', array( 'primary' => 'Primary Navigation Menu' ) );
// Sidebars
unregister_sidebar( 'sidebar-alt' );
//genesis_register_sidebar( array( 'name' => 'Blog Sidebar', 'id' => 'blog-sidebar' ) );
//add_theme_support( 'genesis-footer-widgets', 4 );
// Remove Unused Page Layouts
//genesis_unregister_layout( 'full-width-content' );
//genesis_unregister_layout( 'content-sidebar' );
//genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
// Remove Unused User Settings
add_filter( 'user_contactmethods', 'be_contactmethods' );
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' );
// Setup Theme Settings
include_once( CHILD_DIR . '/lib/functions/child-theme-settings.php' );
// Don't update theme
add_filter( 'http_request_args', 'be_dont_update_theme', 5, 2 );
// ** Frontend **
// Remove Edit link
add_filter( 'genesis_edit_post_link', '__return_false' );
// Responsive Meta Tag
add_action( 'genesis_meta', 'be_viewport_meta_tag' );
// Footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'be_footer' );
}
// ** Backend Functions ** //
/**
* Customize Contact Methods
* @since 1.0.0
*
* @author Bill Erickson
* @link http://sillybean.net/2010/01/creating-a-user-directory-part-1-changing-user-contact-fields/
*
* @param array $contactmethods
* @return array
*/
function be_contactmethods( $contactmethods ) {
unset( $contactmethods['aim'] );
unset( $contactmethods['yim'] );
unset( $contactmethods['jabber'] );
return $contactmethods;
}
/**
* Don't Update Theme
* @since 1.0.0
*
* If there is a theme in the repo with the same name,
* this prevents WP from prompting an update.
*
* @author Mark Jaquith
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
*
* @param array $r, request arguments
* @param string $url, request url
* @return array request arguments
*/
function be_dont_update_theme( $r, $url ) {
if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) )
return $r; // Not a theme update request. Bail immediately.
$themes = unserialize( $r['body']['themes'] );
unset( $themes[ get_option( 'template' ) ] );
unset( $themes[ get_option( 'stylesheet' ) ] );
$r['body']['themes'] = serialize( $themes );
return $r;
}
// ** Frontend Functions ** //
/**
* Viewport Meta Tag for Mobile Browsers
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/responsive-meta-tag
*/
function be_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}
/**
* Footer
*
*/
function be_footer() {
echo '<div class="one-half first" id="footer-left">' . wpautop( genesis_get_option( 'footer-left', 'child-settings' ) ) . '</div>';
echo '<div class="one-half" id="footer-right">' . wpautop( genesis_get_option( 'footer-right', 'child-settings' ) ) . '</div>';
}