-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
312 lines (196 loc) · 7.8 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.1.2' );
//* Enqueue Google Fonts
add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
function genesis_sample_google_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700,300,400:latin', array(), CHILD_THEME_VERSION );
}
//* Enqueue Lato Google font
add_action( 'wp_enqueue_scripts', 'sp_load_google_fonts_lato' );
function sp_load_google_fonts_lato() {
wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION );
}
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Add support for custom background
add_theme_support( 'custom-background' );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
//* Main menu*/
remove_action( 'genesis_after_header', 'genesis_do_nav' );
//add_action( 'genesis_before_header', 'genesis_do_nav', 5 );
//* Add new featured image sizes
add_image_size( 'home-service-area', 125, 125, TRUE );
//* First Row Widgets
//* Main Left Image
genesis_register_sidebar( array(
'id' => 'web_design_image',
'name' => __( 'Web Design Image Left', 'sample' ),
'description' => __( 'Main image left under video', 'sample' ),
) );
//* Copy to right of image
genesis_register_sidebar( array(
'id' => 'web_design_copy',
'name' => __( 'Web Design Copy Right', 'sample' ),
'description' => __( 'Text Blurb to right of main picture', 'sample' ),
) );
//* Second Row - Services Block (Web Designs Modifications Hosting)
//* Web Design Widget
genesis_register_sidebar( array(
'id' => 'services_web_design',
'name' => __( 'Services-Web Design', 'sample' ),
'description' => __( 'Web Design Blurb', 'sample' ),
) );
//* Modification Widget
genesis_register_sidebar( array(
'id' => 'services_mods',
'name' => __( 'Services-Modifications and Maintenance', 'sample' ),
'description' => __( 'Modifications and Maintenance Blurb', 'sample' ),
) );
//* Hosting Widget
genesis_register_sidebar( array(
'id' => 'services_host',
'name' => __( 'Service-Hosting', 'sample' ),
'description' => __( 'Hosting Blurb', 'sample' ),
) );
//* Web Gallery (Web Design Demos)
//* First Column
genesis_register_sidebar( array(
'id' => 'demos_column_one',
'name' => __( 'First Column of Demo Section', 'sample' ),
'description' => __( 'Website Samples First Column', 'sample' ),
) );
//* Second Column
genesis_register_sidebar( array(
'id' => 'demos_column_two',
'name' => __( 'Second Column of Demo Section', 'sample' ),
'description' => __( 'Website Samples Second Column', 'sample' ),
) );
//* Third Column
genesis_register_sidebar( array(
'id' => 'demos_column_three',
'name' => __( 'ThirdColumn of Demo Section', 'sample' ),
'description' => __( 'Website Samples Third Column', 'sample' ),
) );
//* Blog, Testimonial Row
//* 1st Column
genesis_register_sidebar( array(
'id' => 'testimonial',
'name' => __( 'Testimonial', 'sample' ),
'description' => __( 'For Testimonials', 'sample' ),
) );
//* Copy to right of image
genesis_register_sidebar( array(
'id' => 'for_blog',
'name' => __( 'Blog', 'sample' ),
'description' => __( 'Blog or Recent Post area', 'sample' ),
) );
//* Call to Action Blog left
genesis_register_sidebar( array(
'id' => 'cta_blog_left',
'name' => __( 'CTA or Blog Left', 'sample' ),
'description' => __( 'Call to Action and/or Blog area', 'sample' ),
) );
//* Call to Action Blog right
genesis_register_sidebar( array(
'id' => 'cta_blog_right',
'name' => __( 'CTA or Blog Right', 'sample' ),
'description' => __( 'Call to Action and/or Blog', 'sample' ),
) );
// Reposition header outside main wrap
remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
remove_action( 'genesis_header', 'genesis_do_header' );
remove_action( 'genesis_header', 'genesis_header_markup_close', 15 ) ;
add_action( 'genesis_before', 'genesis_header_markup_open', 5 );
add_action( 'genesis_before', 'genesis_do_header' );
add_action( 'genesis_before', 'genesis_header_markup_close', 15 );
/**
*Customer Support admin notice
/* */
function howdy_message($translated_text, $text, $domain) {
$new_message = str_replace('Howdy', 'Call Listen to the Wind Media at 678-520-9914 if you have a question', $text);
return $new_message;
}
add_filter('gettext', 'howdy_message', 10, 3);
/**
* Move Genesis child theme style sheet to a much later priority to give any plugins a chance to load first.
* @author Alain Schlesser <alain.schlesser@gmail.com>
*
* @see http://docs.garyjones.co.uk/genesis/2.0.0/function-genesis_load_stylesheet.html
*/
function as_postpone_genesis_stylesheet() {
// set very high priority for the enqueue action
$priority = 999;
// re-enqueue with high priority
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
add_action( 'wp_enqueue_scripts', 'genesis_enqueue_main_stylesheet', $priority );
}
add_action( 'genesis_setup', 'as_postpone_genesis_stylesheet' );
//* Create a shortcode to display our custom Go to top link
add_shortcode('footer_custombacktotop', 'set_footer_custombacktotop');
function set_footer_custombacktotop($atts) {
return '
<a href="#" class="top">Return to top of page</a>
';
}
//* Add smooth scrolling for any link having the class of "top"
add_action('wp_footer', 'go_to_top');
function go_to_top() { ?>
<script type="text/javascript">
jQuery(function($) {
$('a.top').click(function() {
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});
</script>
<?php }
//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
$creds = '[footer_copyright] · <a href="http://www.listentothewindmedia.com">Listen to the Wind Media</a> · [footer_custombacktotop]';
return $creds;
}
//END OF SMOOTH SCROOL TO TOP
//* Enqueue jQuery core files from header to footer in WordPress
function rw_enqueue_jquery_in_footer( &$scripts ) {
if ( ! is_admin() ) {
$scripts->registered['jquery']->args = 1;
$scripts->registered['jquery-core']->args = 1;
$scripts->registered['jquery-migrate']->args = 1;
}
}
add_action( 'wp_default_scripts', 'rw_enqueue_jquery_in_footer', 11 );
function rw_add_enqueue_jquery_in_footer() {
wp_enqueue_script( 'jquery-core' );
wp_enqueue_script( 'jquery-migrate' );
}
add_action( 'init', 'rw_add_enqueue_jquery_in_footer' );
//* Enqueue EQCSS
// http://elementqueries.com/
add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
function sk_enqueue_scripts() {
wp_enqueue_script( 'EQCSS', get_stylesheet_directory_uri() . '/js/EQCSS.min.js', '', '', true );
}
// Register bottom-flyout widget area
genesis_register_widget_area(
array(
'id' => 'bottom-flyout',
'name' => __( 'Bottom Flyout', 'my-theme-text-domain' ),
'description' => __( 'Widget(s) placed here will appear on scrolling down from bottom right', 'my-theme-text-domain' ),
));
// Display bottom-flyout widget area
add_action( 'wp_footer', 'sk_bottom_flyout' );
function sk_bottom_flyout() {
genesis_widget_area( 'bottom-flyout', array(
'before' => '<div class="bottom-flyout">',
'after' => '</div>',
));
}