forked from champsupertramp/working-three
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
506 lines (435 loc) · 24.5 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
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
<?php
/**
* Class WD_WorkingThree holds all theme functions
*
* @version 1.0
* @author Champ Camba - www.worlddigital.com.au
*/
class WD_WorkingThree{
/**
* Theme assets URLs
* @var array
*/
public $tpl_url = array();
/**
* Init
*/
function __construct(){
// Action Hooks
if( is_admin() ){ // Admin hooks
add_action('after_setup_theme' , array( $this, 'theme_setup' ) ,10 );
add_action('after_switch_theme', array( $this, 'flush_rewrite_rules') );
add_filter( 'user_contactmethods', array($this, 'add_user_contact_methods'), 10, 1 );
}else{ // Front-end hooks
add_action("wp_enqueue_scripts" ,array( $this, "load_assets" ),100);
add_filter('nav_menu_css_class' ,array( $this,'add_classes_on_li'),1,3);
add_filter('nav_menu_link_attributes', array( $this, 'add_classes_on_menu_anchor'), 10, 3 );
add_action('init', array( $this,'register_post_types' ),10);
add_filter( 'template_include', array( $this, 'single_post_template') , 99 );
}
// Set URLs
$this->tpl_url = array(
"tpl" => get_template_directory_uri(),
"assets" => get_template_directory_uri().'/assets/',
"img" => get_template_directory_uri().'/assets/img',
"css" => get_template_directory_uri().'/assets/css',
"js" => get_template_directory_uri().'/assets/js',
);
// Include theme framework
require_once dirname( __FILE__ ) .'/codestar-framework/cs-framework.php';
// Include Navigation Menu Walker
require_once dirname( __FILE__ ) .'/lib/class-menu-walker.php';
}
/**
* Loads default setup during theme activation
*
* @since 1.0
*/
public function theme_setup(){
// Make theme available for translation
load_theme_textdomain('workingthree', get_template_directory() . '/lang');
// Enable plugins to manage the document title
// http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
add_theme_support('title-tag');
// Register wp_nav_menu() menus
// http://codex.wordpress.org/Function_Reference/register_nav_menus
register_nav_menus(array(
'primary_navigation' => __('Primary Navigation', 'workingthree'),
'leadership_navigation' => __('Leadership Template Navigation', 'workingthree'),
));
// Add post thumbnails
// http://codex.wordpress.org/Post_Thumbnails
// http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size
// http://codex.wordpress.org/Function_Reference/add_image_size
add_theme_support('post-thumbnails');
add_image_size( 'image_740x490', 740, 490, true );
add_image_size( 'image_174x174', 174, 174, true );
add_image_size( 'image_580x400', 580, 400, true );
add_image_size( 'image_400x400', 400, 400, true );
// Add post formats
// http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio'));
// Add feed Links
add_theme_support( 'automatic-feed-links' );
// Add HTML5 markup for captions
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
add_theme_support('html5', array('caption', 'comment-form', 'comment-list'));
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style( $this->tpl_url['assets'].'css/editor-style.css');
$this->register_post_types();
}
/**
* Registers post types & taxonomies
* @since 1.0
*/
public function register_post_types(){
// Register post types
$labels = array(
'name' => _x( 'Case Studies', 'post type general name', 'workingthree' ),
'singular_name' => _x( 'Cast Study', 'post type singular name', 'workingthree' ),
'menu_name' => _x( 'Case Studies', 'admin menu', 'workingthree' ),
'name_admin_bar' => _x( 'Cast Study', 'add new on admin bar', 'workingthree' ),
'add_new' => _x( 'Add New', 'case-study', 'workingthree' ),
'add_new_item' => __( 'Add New Cast Study', 'workingthree' ),
'new_item' => __( 'New Cast Study', 'workingthree' ),
'edit_item' => __( 'Edit Cast Study', 'workingthree' ),
'view_item' => __( 'View Cast Study', 'workingthree' ),
'all_items' => __( 'All Case Studies', 'workingthree' ),
'search_items' => __( 'Search Case Studies', 'workingthree' ),
'parent_item_colon' => __( 'Parent Case Studies:', 'workingthree' ),
'not_found' => __( 'No Case Studies found.', 'workingthree' ),
'not_found_in_trash' => __( 'No Case Studies found in Trash.', 'workingthree' )
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.', 'workingthree' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'case-study' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title',/*, 'editor', 'author', */'thumbnail'/*, 'excerpt', 'comments' */)
);
register_post_type( 'casestudy', $args );
$labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'popular_items' => __( 'Popular Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
'separate_items_with_commas' => __( 'Separate categories with commas' ),
'add_or_remove_items' => __( 'Add or remove categories' ),
'choose_from_most_used' => __( 'Choose from the most used categories' ),
'not_found' => __( 'No categories found.' ),
'menu_name' => __( 'Categories' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'casestudy-categories' ),
);
register_taxonomy( 'casestudy_categories', 'casestudy', $args );
// Register post types
$labelstm = array(
'name' => _x( 'Team Members', 'post type general name', 'workingthree' ),
'singular_name' => _x( 'Team Member', 'post type singular name', 'workingthree' ),
'menu_name' => _x( 'Team Members', 'admin menu', 'workingthree' ),
'name_admin_bar' => _x( 'Team Member', 'add new on admin bar', 'workingthree' ),
'add_new' => _x( 'Add New', 'team-member', 'workingthree' ),
'add_new_item' => __( 'Add New Team Member', 'workingthree' ),
'new_item' => __( 'New Team Member', 'workingthree' ),
'edit_item' => __( 'Edit Team Member', 'workingthree' ),
'view_item' => __( 'View Team Member', 'workingthree' ),
'all_items' => __( 'All Team Members', 'workingthree' ),
'search_items' => __( 'Search Team Members', 'workingthree' ),
'parent_item_colon' => __( 'Parent Team Member:', 'workingthree' ),
'not_found' => __( 'No Team Members found.', 'workingthree' ),
'not_found_in_trash' => __( 'No Team Members found in Trash.', 'workingthree' )
);
$argstm = array(
'labels' => $labelstm,
'description' => __( 'Description.', 'workingthree' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'team-member' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'teammember', $argstm );
$labelstm = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'popular_items' => __( 'Popular Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
'separate_items_with_commas' => __( 'Separate categories with commas' ),
'add_or_remove_items' => __( 'Add or remove categories' ),
'choose_from_most_used' => __( 'Choose from the most used categories' ),
'not_found' => __( 'No categories found.' ),
'menu_name' => __( 'Categories' ),
);
$argstm = array(
'hierarchical' => true,
'labels' => $labelstm,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'team-member-categories' ),
);
register_taxonomy( 'teammember_categories', 'teammember', $argstm );
}
/**
* Adds classe to menu li elements
*
* @param Array $classes
* @param Array $item
* @param Array $args
*/
public function add_classes_on_li($classes, $item, $args) {
$classes[] = 'menu-top-item';
return $classes;
}
/**
* Add only "a-class-" prefixed classes to the menu link attribute
*
* @param Array $atts
* @param Array $item
*/
public function add_classes_on_menu_anchor($atts, $item, $args){
$atts['class'] = 'menu-top-link';
return $atts;
}
/**
* Template color schemes
* @param string $scheme
* @return string
*/
public function get_gradient_color( $scheme = 'blue' ){
$arr = array(
'blue' => array(
'left' => 'blue',
'right' => 'blue-dark'
),
'green' => array(
'left' => 'green',
'right' => 'green-dark'
),
'yellow' => array(
'left' => 'yellow',
'right' => 'yellow-dark'
),
'purple' => array(
'left' => 'purple',
'right' => 'purple-dark'
),
'red' => array(
'left' => 'red',
'right' => 'red-dark'
),
'grey' => array(
'left' => 'darkgrey-dark',
'right' => 'darkgrey'
),
);
return $arr[ $scheme ];
}
/**
* Loads all scripts and styles
*
* @since 1.0
*/
public function load_assets(){
//scripts
wp_enqueue_script( 'working-three-scripts', $this->tpl_url['assets'] . '/js/main.js', array(), '1.0.0', true );
wp_enqueue_script( 'less', '//cdnjs.cloudflare.com/ajax/libs/less.js/2.5.1/less.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'jquery-color', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js', array(), '1.0.0', true );
//stylesheets
wp_enqueue_style( 'jquery-ui', "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" );
wp_enqueue_style( 'working-three-main-style', $this->tpl_url['assets'].'css/main-style.css' );
wp_enqueue_style( 'working-three-main-style-mobile', $this->tpl_url['assets'].'css/main-style-mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-main-style-table', $this->tpl_url['assets'].'css/main-style-tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
/**
* Home / Landing page
*/
if ( is_home() || is_front_page() ) {
wp_enqueue_style( 'working-three-landing', $this->tpl_url['assets'].'css/home.css' );
wp_enqueue_style( 'working-three-landing-mobile', $this->tpl_url['assets'].'css/home_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-landing-table', $this->tpl_url['assets'].'css/home_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
//script
wp_enqueue_script( 'jquery-colorscroll', $this->tpl_url['assets'] . '/js/jquery.colorscroll.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'jquery-snapscroll', $this->tpl_url['assets'] . '/js/jquery.snapscroll.js', array(), '1.0.0', true );
wp_enqueue_script( 'jquery-scroll_to', $this->tpl_url['assets'] . '/js/jquery.scroll_to.js', array(), '1.0.0', true );
wp_enqueue_script( 'working-three-homepage-scripts', $this->tpl_url['assets'] . '/js/homepage.js', array(), '1.0.0', true );
}
/**
* About us
*/
elseif( is_page_template("template-about-us.php") ){
wp_enqueue_style( 'working-three-about-us', $this->tpl_url['assets'].'css/about-us.css' );
wp_enqueue_style( 'working-three-about-us-mobile', $this->tpl_url['assets'].'css/about-us_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-about-us-table', $this->tpl_url['assets'].'css/about-us_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Contact
*/
elseif( is_page_template("template-contact.php") ){
wp_enqueue_style( 'working-three-contact', $this->tpl_url['assets'].'css/contact.css' );
wp_enqueue_style( 'working-three-contact-mobile', $this->tpl_url['assets'].'css/contact_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-contact-table', $this->tpl_url['assets'].'css/contact_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Insights
*/
elseif( is_page_template("template-insights.php") ){
wp_enqueue_style( 'working-three-howwework', $this->tpl_url['assets'].'css/howwework.css' );
wp_enqueue_style( 'working-three-howwework-mobile', $this->tpl_url['assets'].'css/howweworkmobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-howwework-table', $this->tpl_url['assets'].'css/howweworktablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Who We Work With
*/
elseif( is_page_template("template-work.php") ){
wp_enqueue_style( 'working-three-who-we-work-with', $this->tpl_url['assets'].'css/who-we-work-with.css' );
wp_enqueue_style( 'working-three-who-we-work-with-mobile', $this->tpl_url['assets'].'css/who-we-work-with_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-who-we-work-with-table', $this->tpl_url['assets'].'css/who-we-work-with_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
wp_enqueue_script( 'mixitup', 'http://cdn.jsdelivr.net/jquery.mixitup/latest/jquery.mixitup.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'jquery-migrate', '//code.jquery.com/jquery-migrate-1.2.1.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'slick', '//cdn.jsdelivr.net/jquery.slick/1.5.7/slick.min.js', array(), '1.0.0', true );
wp_enqueue_style( 'slick-css', "https://cdn.jsdelivr.net/jquery.slick/1.5.7/slick.css" );
//wp_enqueue_style( 'slick-theme', $this->tpl_url['assets'].'css/slick-theme.css' );
}
/**
* Case Studies
*/
elseif( is_page_template("template-case-studies.php") ){
wp_enqueue_style( 'working-three-case-studies-overview', $this->tpl_url['assets'].'css/case-studies-overview.css' );
wp_enqueue_style( 'working-three-case-studies-overview-mobile', $this->tpl_url['assets'].'css/case-studies-overview-mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-case-studies-overview-table', $this->tpl_url['assets'].'css/case-studies-overview-tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Blog
*/
elseif( is_page_template("template-blog.php") ){
wp_enqueue_style( 'working-three-insights-and-article', $this->tpl_url['assets'].'css/insights-and-article.css' );
wp_enqueue_style( 'working-three-insights-and-article-mobile', $this->tpl_url['assets'].'css/insights-and-article-mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-insights-and-article-table', $this->tpl_url['assets'].'css/insights-and-article-tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Contact
*/
elseif( is_page_template("template-contact.php") ){
wp_enqueue_style( 'working-three-contact', $this->tpl_url['assets'].'css/contact.css' );
wp_enqueue_style( 'working-three-contact-mobile', $this->tpl_url['assets'].'css/contact_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-contact-table', $this->tpl_url['assets'].'css/contact_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Case Study
*/
elseif ( is_singular( 'casestudy' ) ) {
wp_enqueue_style( 'working-three-case-study', $this->tpl_url['assets'].'css/case-study.css' );
wp_enqueue_style( 'working-three-case-study-mobile', $this->tpl_url['assets'].'css/case-study_mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-case-study-table', $this->tpl_url['assets'].'css/case-study_tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
wp_enqueue_script( 'slick', '//cdn.jsdelivr.net/jquery.slick/1.5.7/slick.min.js', array(), '1.0.0', true );
wp_enqueue_style( 'slick-css', "https://cdn.jsdelivr.net/jquery.slick/1.5.7/slick.css" );
}
/**
* Services
*/
elseif ( is_page_template("template-services.php") ) {
wp_enqueue_style( 'working-three-howwework', $this->tpl_url['assets'].'css/howwework.css' );
wp_enqueue_style( 'working-three-howwework-mobile', $this->tpl_url['assets'].'css/howweworkmobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-howwework-table', $this->tpl_url['assets'].'css/howweworktablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
/**
* Insights and Articles Content
*/
elseif( is_single() || is_page() ){
wp_enqueue_style( 'working-three-insights-and-article-content', $this->tpl_url['assets'].'css/insights-and-article-content.css' );
wp_enqueue_style( 'working-three-insights-and-article-content-mobile', $this->tpl_url['assets'].'css/insights-and-article-content-mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-insights-and-article-content-table', $this->tpl_url['assets'].'css/insights-and-article-content-tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}else{
wp_enqueue_style( 'working-three-insights-and-article', $this->tpl_url['assets'].'css/insights-and-article.css' );
wp_enqueue_style( 'working-three-insights-and-article-mobile', $this->tpl_url['assets'].'css/insights-and-article-mobile.css',array(),'1.0.0','only screen and (min-width: 0px) and (max-width: 767px) and (orientation: portrait)' );
wp_enqueue_style( 'working-three-insights-and-article-table', $this->tpl_url['assets'].'css/insights-and-article-tablet.css',array(),'1.0.0','only screen and (min-width: 768px) and (max-width: 959px)and (orientation: portrait)' );
}
wp_enqueue_style( 'working-three', $this->tpl_url['assets'].'css/main.css' );
}
/**
* Allow single post/post type template
*
* @since 1.0
*/
public function single_post_template( $template ){
if ( is_single() && get_post_type(get_the_ID() ) == 'casestudy' ) {
$_template = locate_template( array( 'single-casestudy.php' ) );
$template = ( $_template ) ? $_template : $template;
}
return $template;
}
/**
* Adds user contact methods
*/
public function add_user_contact_methods( $contactmethods ){
if ( !isset( $contactmethods['position'] ) )
$contactmethods['position'] = 'Position';
if ( !isset( $contactmethods['twitter'] ) )
$contactmethods['twitter'] = 'Twitter';
if ( !isset( $contactmethods['linkedin'] ) )
$contactmethods['linkedin'] = 'Linkedin';
return $contactmethods;
}
/**
* Flush rewrite rules for custom post types
*
* @since 1.0
*/
public function flush_rewrite_rules() {
flush_rewrite_rules();
}
}
$wd_wt = new WD_WorkingThree;
global $wd_wt;
function remove_sharethis() {
remove_filter('the_content', 'st_add_widget');
remove_filter('the_excerpt', 'st_add_widget');
remove_action('wp_head', 'st_widget_head');
}
add_action( 'template_redirect', 'remove_sharethis' );
function print_sharethis_widget( ){
print st_widget_head();
print st_add_widget('');
}
add_action( 'custom_sharethis_widget','print_sharethis_widget');
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );