-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
453 lines (367 loc) · 14 KB
/
functions.php
File metadata and controls
453 lines (367 loc) · 14 KB
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<?php
// add login link up top
add_action( 'woo_header_inside', 'gfp_login', 9 );
function gfp_login() {
?>
<div class='col-full top-login'>
<div class="login-contact">
<?php woo_add_header_phone_number(); ?>
<a href='<?php echo get_permalink( 141 ); ?>' class='woo-sc-button aqua'>
<span class='woo-'>Customer Login</span>
</a>
</div>
</div>
<?php
}
// Move phone number above nav
add_action( 'woo_nav_before', 'gfp_ditch_phone' );
function gfp_ditch_phone() {
remove_all_actions( 'woo_nav_after' );
}
// Staff links
function gfp_staff_links() {
global $post;
$gfp_staff = get_post( $post )->post_name;
$gfp_id = get_the_id();
if ( $gfp_id === 13 OR $gfp_id === 6 OR $gfp_id === 14 ) : {
?>
<div class="widget staff-menu">
<div class="inner">
<?php wp_nav_menu( array( 'menu' => $gfp_staff ) ); ?>
</div>
</div>
<?php
}
endif;
}
add_action( 'woo_sidebar_inside_before', 'gfp_staff_links' );
// Custom image size
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'intro-img', 180, 120, false );
}
// Financial Planning shortcode
function financial_planning() {
?>
<span class="LimelightEmbeddedPlayer">
<script src="https://video.limelight.com/player/embed.js"></script>
<object type="application/x-shockwave-flash" id="limelight_player_746472" name="limelight_player_746472"
class="LimelightEmbeddedPlayerFlash" width="360" height="203"
data="https://video.limelight.com/player/loader.swf">
<param name="movie" value="https://video.limelight.com/player/loader.swf">
<param name="wmode" value="window"/>
<param name="allowScriptAccess" value="always"/>
<param name="allowFullScreen" value="true"/>
<param name="flashVars"
value="mediaId=7edab8048c5a4d59a6cc53c60497e9e8&deepLink=true&playerForm=74a4584427884e2da78ac8b3f8ecdd0b"/>
</object>
<script>LimelightPlayerUtil.initEmbed('limelight_player_746472');</script>
</span><br>©2014 Broadridge Investor Solutions, Inc.
<?php
}
add_shortcode( 'fp', 'financial_planning' );
// Rising rates shortcode
function rising_rates() {
?>
<span class="LimelightEmbeddedPlayer">
<script src="https://video.limelight.com/player/embed.js">
</script>
<object type="application/x-shockwave-flash" id="limelight_player_746472" name="limelight_player_746472"
class="LimelightEmbeddedPlayerFlash" width="360" height="203"
data="https://video.limelight.com/player/loader.swf">
<param name="movie" value="https://video.limelight.com/player/loader.swf">
<param name="wmode" value="window"/>
<param name="allowScriptAccess" value="always"/>
<param name="allowFullScreen" value="true"/>
<param name="flashVars"
value="mediaId=5281c6cc33624fd98f0ecbf27f0cfd4a&deepLink=true&playerForm=74a4584427884e2da78ac8b3f8ecdd0b"/>
</object>
<script>LimelightPlayerUtil.initEmbed('limelight_player_746472');</script>
</span><br>©2014 Broadridge Investor Solutions, Inc.
<?php
}
add_shortcode( 'rr', 'rising_rates' );
// Woo phone number
function woo_phone_number() {
global $woo_options;
$phone = esc_html( $woo_options['woo_contact_number'] );
return $phone;
}
// Woo phone number shortcode
add_shortcode( 'woo_phone', 'woo_phone_number' );
// Change capability needed to change options in the Customizer for things in WP Core
add_action( 'customize_register', 'add_site_identity_for_non_admins' );
function add_site_identity_for_non_admins( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->capability = 'edit_theme_options';
$wp_customize->get_setting( 'blogdescription' )->capability = 'edit_theme_options';
}
// Add Customizer Controls
add_action( 'customize_register', 'genfinplan_customize_register' );
function genfinplan_customize_register( $wp_customize ) {
$wp_customize->add_section( 'genfinplan_cta' , array(
'title' => __( 'CTA Settings', 'genfinplan' ),
'priority' => 30,
'active_callback' => 'is_front_page',
)
);
$wp_customize->add_setting( 'genfinplan_cta_heading' , array(
'default' => 'Helping a Select Group of Families Achieve their Life Goals',
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'genfinplan_cta_heading', array(
'label' => __( 'CTA Heading', 'genfinplan' ),
'section' => 'genfinplan_cta',
'settings' => 'genfinplan_cta_heading',
) ) );
// WP_Customize_Media_Control returns an Attachment ID instead of an Attachment URL, this way we can get whatever size we want
$wp_customize->add_setting( 'genfinplan_cta_image' , array(
'default' => 160,
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'genfinplan_cta_image', array(
'label' => __( 'CTA Image', 'genfinplan' ),
'section' => 'genfinplan_cta',
'mime_type' => 'image',
) ) );
$wp_customize->add_setting( 'genfinplan_cta_copy' , array(
'default' => 'Servicing Southwest Michigan and clients nationwide, helping you make the right choices. We understand that the complexities of the Markets and Financial Vehicles can be daunting. Our combined experience of 19 years can help you plan and prepare for your life’s goals.',
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'genfinplan_cta_copy', array(
'type' => 'textarea',
'label' => __( 'CTA Body Copy', 'genfinplan' ),
'section' => 'genfinplan_cta',
'settings' => 'genfinplan_cta_copy',
) ) );
$wp_customize->add_setting( 'genfinplan_cta_button_text' , array(
'default' => 'Plan for my future',
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'genfinplagenfinplan_cta_button_textn_cta_heading', array(
'label' => __( 'CTA Button Text', 'genfinplan' ),
'section' => 'genfinplan_cta',
'settings' => 'genfinplan_cta_button_text',
) ) );
$wp_customize->add_setting( 'genfinplan_cta_button_url' , array(
'default' => '/wealth-management-services/financial-planning/',
'transport' => 'refresh',
)
);
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'genfinplan_cta_button_url', array(
'label' => __( 'CTA Button Link', 'genfinplan' ),
'section' => 'genfinplan_cta',
'settings' => 'genfinplan_cta_button_url',
) ) );
}
add_action( 'init', 'genfinplan_remove_contact_editor' );
function genfinplan_remove_contact_editor() {
if ( is_admin() && isset( $_REQUEST['post'] ) && ( 'template-contact.php' == get_post_meta( $_REQUEST['post'], '_wp_page_template', true ) ) ) {
remove_post_type_support( 'page', 'editor' );
}
}
add_action( 'add_meta_boxes', 'genfinplan_add_contact_metaboxes' );
function genfinplan_add_contact_metaboxes() {
global $post;
if ( 'template-contact.php' == get_post_meta( $post->ID, '_wp_page_template', true ) ) {
add_meta_box(
'genfinplan-contact-left',
__( 'Contact - Left', 'genfinplan' ),
'genfinplan_contact_left',
'page',
'normal',
'high'
);
add_meta_box(
'genfinplan-contact-right',
__( 'Contact - Right', 'genfinplan' ),
'genfinplan_contact_right',
'page',
'normal',
'high'
);
add_meta_box(
'genfinplan-contact-below',
__( 'Contact - Below', 'genfinplan' ),
'genfinplan_contact_below',
'page',
'normal',
'high'
);
}
}
function genfinplan_contact_left() {
genfinplan_create_contact_meta( 'left' );
}
function genfinplan_contact_right() {
genfinplan_create_contact_meta( 'right' );
}
function genfinplan_create_contact_meta( $key ) {
$slider_query = get_posts( array(
'post_type' => 'soliloquy',
'posts_per_page' => -1,
) );
$sliders = wp_list_pluck( $slider_query, 'post_title', 'ID' );
rbm_do_field_select(
'contact_' . $key . '_slider',
__( 'Slider', 'genfinplan' ),
false,
array(
'options' => $sliders,
)
);
rbm_do_field_text(
'contact_' . $key . '_title',
__( 'Location Name', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_street_address',
__( 'Street Address', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_city',
__( 'City', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_state',
__( 'State', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_zip',
__( 'ZIP Code', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_phone',
__( 'Phone Number', 'genfinplan' ),
false,
array(
)
);
rbm_do_field_text(
'contact_' . $key . '_fax',
__( 'Fax Number', 'genfinplan' ),
false,
array(
)
);
}
function genfinplan_contact_below() {
rbm_do_field_wysiwyg(
'contact_content',
__( 'Content', 'Home About Content', 'genfinplan' ),
false,
array(
)
);
}
/**
* PHP 7.x compatibility fix. Just swapped out mysql_real_escape_string() for esc_sql()
*/
function woothemes_add_admin() {
global $query_string;
global $current_user;
$current_user_id = $current_user->user_login;
$super_user = get_option( 'framework_woo_super_user' );
$themename = get_option( 'woo_themename' );
$shortname = get_option( 'woo_shortname' );
// Reset the settings, sanitizing the various requests made.
// Use a SWITCH to determine which settings to update.
/* Make sure we're making a request.
------------------------------------------------------------*/
if ( isset( $_REQUEST['page'] ) ) {
// Sanitize page being requested.
$_page = '';
$_page = esc_sql( strtolower( trim( strip_tags( $_REQUEST['page'] ) ) ) );
// Sanitize action being requested.
$_action = '';
if ( isset( $_REQUEST['woo_save'] ) ) {
$_action = esc_sql( strtolower( trim( strip_tags( $_REQUEST['woo_save'] ) ) ) );
} // End IF Statement
// If the action is "reset", run the SWITCH.
/* Perform settings reset.
------------------------------------------------------------*/
if ( $_action == 'reset' ) {
// Add nonce security check.
if ( function_exists( 'check_ajax_referer' ) ) {
if ( $_page == 'woothemes_seo' ) {
check_ajax_referer( 'wooframework-seo-options-reset', '_ajax_nonce' );
} else {
check_ajax_referer( 'wooframework-theme-options-reset', '_ajax_nonce' );
}
} // End IF Statement
switch ( $_page ) {
case 'woothemes':
$options = get_option( 'woo_template' );
woo_reset_options( $options, 'woothemes' );
header( "Location: admin.php?page=woothemes&reset=true" );
die;
break;
case 'woothemes_framework_settings':
$options = get_option( 'woo_framework_template' );
woo_reset_options( $options );
header( "Location: admin.php?page=woothemes_framework_settings&reset=true" );
die;
break;
case 'woothemes_seo':
$options = get_option( 'woo_seo_template' );
woo_reset_options( $options );
header( "Location: admin.php?page=woothemes_seo&reset=true" );
die;
break;
case 'woothemes_sbm':
delete_option( 'sbm_woo_sbm_options' );
header( "Location: admin.php?page=woothemes_sbm&reset=true" );
die;
break;
} // End SWITCH Statement
} // End IF Statement
} // End IF Statement
// Check all the Options, then if the no options are created for a relative sub-page... it's not created.
if( get_option( 'framework_woo_backend_icon' ) ) { $icon = get_option( 'framework_woo_backend_icon' ); }
else { $icon = get_template_directory_uri() . '/functions/images/woo-icon.png'; }
if( function_exists( 'add_object_page' ) ) {
add_object_page ( 'Page Title', $themename, 'manage_options', 'woothemes', 'woothemes_options_page', $icon );
} else {
add_menu_page ( 'Page Title', $themename, 'manage_options', 'woothemes_home', 'woothemes_options_page', $icon );
}
$woopage = add_submenu_page( 'woothemes', $themename, __( 'Theme Options', 'woothemes' ), 'manage_options', 'woothemes', 'woothemes_options_page' ); // Default
// Framework Settings Menu Item
$wooframeworksettings = '';
if( $super_user == $current_user_id || empty( $super_user ) ) {
$wooframeworksettings = add_submenu_page( 'woothemes', __( 'Framework Settings', 'woothemes' ), __( 'Framework Settings', 'woothemes' ), 'manage_options', 'woothemes_framework_settings', 'woothemes_framework_settings_page' );
}
// Woothemes Content Builder
if ( function_exists( 'woothemes_content_builder_menu' ) ) {
woothemes_content_builder_menu();
}
// Update Framework Menu Item
if( $super_user == $current_user_id || empty( $super_user ) ) {
$woothemepage = add_submenu_page( 'woothemes', 'WooFramework Update', 'Update Framework', 'manage_options', 'woothemes_framework_update', 'woothemes_framework_update_page' );
}
// Add framework functionaily to the head individually
add_action( "admin_print_scripts-$woopage", 'woo_load_only' );
add_action( "admin_print_scripts-$wooframeworksettings", 'woo_load_only' );
// Load Framework CSS Files
add_action( "admin_print_styles-$woopage", 'woo_framework_load_css' );
add_action( "admin_print_styles-$wooframeworksettings", 'woo_framework_load_css' );
// Add the non-JavaScript "save" to the load of each of the screens.
add_action( "load-$woopage", 'woo_nonajax_callback' );
add_action( "load-$wooframeworksettings", 'woo_nonajax_callback' );
}