forked from Jonnyauk/Wonderflux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
1695 lines (1452 loc) · 56.4 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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Wonderflux is a free open source, theme framework for professional WordPress theme design.
* License: GNU General Public License v2.0
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
* I'M NOT MEANT TO BE ACTIVATED DIRECTLY THANKS - IM A THEME FRAMEWORK!
* Put me in your themes folder along with a Wonderflux child theme, then activate child theme, not me!
*
* Free example child theme: https://github.com/Jonnyauk/wonderflux-girder
*
* GETTING STARTED GUIDES
* Information and license: README.md
* Guide and documentation: http://wonderflux.com/guide
* Introduction to Wonderflux: http://wonderflux.com/guide/doc/introduction
* Wonderflux child themes: http://wonderflux.com/guide/doc/child-theme-files
*
* GETTING INVOLVED
* Bugs/improvements/feedback: https://github.com/Jonnyauk/Wonderflux/issues
* Official release downloads: https://github.com/Jonnyauk/Wonderflux/releases
* Development code: https://github.com/Jonnyauk/Wonderflux
*
* INDEX OF THIS FILE
* 1 - Core framework setup & deployment
* 2 - Helper functions
* 3 - Display functions
* 4 - Social functions
* 5 - Theme configuration functions
* 6 - Javascript support functions
* 7 - Admin functions
* 8 - Admin post/content functions
* 9 - Direct activation fallbacks
*
* DON'T HACK ME! You should NOT modify the Wonderflux theme framework to avoid issues with updates in the future.
* View the readme for more information.
*
* If you still feel the need to hack the Wonderflux core code, why not submit a patch or suggestion?
* https://github.com/Jonnyauk/Wonderflux
*
* DEVELOPERS AND TESTERS
* All development is tracked within the GitHub project.
* Anyone has full checkout access to the latest non-released development code (master branch)
* Note - the master branch on GitHub is for testing and development - NOT for live sites (unless you are brave!)
*
* THANKS FOR USING WONDERFLUX - YOU NOW ROCK!
* Created something cool? Let us know - we can't wait to see what you create!
* Follow @Wonderflux on Twitter for all code updates and news.
*
* @package Wonderflux
*/
/*
#
##
# #
#
#
#
#####
Core framework setup & deployment
*/
// Wonderflux, start your engine
load_template( get_template_directory() . '/wf-includes/wf-engine.php' );
//// 1.1 // Early setup (before init)
add_action( 'after_setup_theme', 'wfx_core_feed_links', 2 );
add_action( 'after_setup_theme', 'wfx_core_title_tag', 2 );
//// 1.2 // Special child theme functions
// Use this to configure all your Wonderflux child theme layout functions like wfx_background_divs()
// Legacy function - deprecated in Wonderflux 2.0, will likely be removed in the future
if ( function_exists('my_wfx_layout') ) { add_action( 'get_header', 'my_wfx_layout', 1 ); }
// Use this to configure all your Wonderflux child theme script functions like wfx_jquery()
// Legacy function - deprecated in Wonderflux 2.0, will likely be removed in the future
if ( function_exists('my_wfx_scripts') ) { if ( !is_admin() ) : add_action( 'init', 'my_wfx_scripts', 1 ); endif; }
//// 1.3 // Columns functionality
// Allow full removal of the framework CSS system or minified version
if ( WF_THEME_FRAMEWORK_NONE == true ) {
// Silence is golden
} elseif ( WF_THEME_FRAMEWORK_REPLACE == true ) {
add_action( 'wf_head_meta', 'wfx_head_css_replace', 2 );
} else {
add_action( 'wf_head_meta', 'wfx_display_head_css_structure', 2 );
add_action( 'wf_head_meta', 'wfx_display_head_css_columns', 2 );
add_action( 'wf_head_meta', 'wfx_display_head_css_ie', 2 );
}
//// 1.4 // If Wonderflux activated directly with no child theme
if ( wp_get_theme()->Name == 'Wonderflux' ) {
add_action( 'after_setup_theme', 'wfx_core_default_setup', 2 );
add_action( 'widgets_init', 'wfx_core_default_widgets', 1 );
add_action( 'get_header', 'wfx_core_default_wrappers', 1 );
// Advised for theme compatibility
add_editor_style( 'style.css' );
$background_defaults = array(
'default-color' => 'ffffff',
'wp-head-callback' => '_custom_background_cb',
);
add_theme_support( 'custom-background', $background_defaults );
add_action( 'after_setup_theme', 'wfx_core_register_nav' );
add_action('wfmain_before_all_container','wfx_core_insert_primary_nav', 2);
}
//// 1.5 // Wonderflux core functionality
add_action( 'after_setup_theme', 'wfx_config_language' );
add_action( 'wp_enqueue_scripts', 'wfx_core_comment_js', 2 );
add_action( 'get_header', 'wfx_display_head_open', 1 );
add_action( 'get_header', 'wfx_display_body_tag', 1 );
add_action( 'the_post', 'wfx_filter_post_class', 2 );
add_action( 'get_header', 'wfx_layout_build', 1 );
add_action( 'get_header', 'wfx_content_width_embed', 2 );
add_action( 'get_header', 'wfx_social_meta' );
add_action( 'get_header', 'wfx_rwd_full_width', 2 );
add_action( 'wf_head_meta', 'wfx_display_head_char_set', 1 );
add_action( 'wf_head_meta', 'wfx_display_head_viewport', 2 );
add_action( 'wf_head_meta', 'wfx_display_head_title', 3 );
add_action( 'wf_head_meta', 'wfx_display_head_css_theme', 3 );
add_action( 'wf_head_meta', 'wfx_display_css_info' );
add_action( 'admin_bar_menu', 'wfx_admin_bar_links', 100 );
add_action( 'wffooter_after_content', 'wfx_display_credit', 1 );
add_action( 'wf_footer', 'wfx_display_code_credit', 3 );
add_action( 'auth_redirect', 'wfx_admin_menus' );
add_filter( 'theme_page_templates','wfx_remove_page_templates' );
//// 1.6 // Wonderflux debug functionality
if ( WF_DEBUG == true ){
add_action( 'init','wfx_show_hooks' );
add_action( 'admin_bar_menu', 'wfx_admin_bar_files_info', 100 );
}
/*
#####
# #
#
#####
#
#
#######
Helper functions
*/
/**
* Creates array of information about file based on filename.
* IMPORTANT - Used internally by Wonderflux.
*
* Filters available:
* wflux_ext_img - array of image file extensions
*
* @since 1.1
* @version 1.1
*
* @param [string] $filename REQUIRED File name with extension (no path)
* @return [array] ext,type,nicetype,playable
*/
if ( !function_exists( 'wfx_info_file' ) ) : function wfx_info_file($filename='') { global $wfx_helper; return $wfx_helper->info_file($filename); } endif;
/**
* Detects what type of content you are currently viewing.
* IMPORTANT - Used internally by Wonderflux.
*
* @since 0.881
* @version 1.0RC3
*
* @param none
* @return [string] Current view - eg 'category'
*/
if ( !function_exists( 'wfx_info_location' ) ) : function wfx_info_location() { global $wfx_helper; return $wfx_helper->info_location(); } endif;
/**
* Detects if you are viewing single content - post, page, attachment, author
* as opposed to archive or any other type of views, kinda like is_singular() and is_single()
*
* @since 1.0
* @version 1.1
*
* @param none
* @return [bool] true/false
*/
if ( !function_exists( 'wfx_info_single' ) ) : function wfx_info_single() { global $wfx_helper; return $wfx_helper->info_single(); } endif;
/**
* Turbo-charged get_template_part file include - loads a template part into a template.
* IMPORTANT: Used by Wonderflux internally to setup smarter specific template parts.
*
* Appends various location information and uses those files if available in your theme folder.
*
* Can also use mobile optimised screen alternative template parts for non-desktop devices (like phones or tablets)
* by creating an additional file with '-mobile' appended, like: loop-content-single-mobile.php
*
* EXAMPLES
* All examples are with $part='loop-content' and shows the order of priority of files
*
* SINGLE POST (INCLUDING CUSTOM POST TYPES)
* NOTE: Normal 'post' post type uses loop-content-single.php NOT loop-content-single-post.php
* 1 loop-content-single-{POST-TYPE-SLUG}.php
* 2 loop-content-single.php
* 3 loop-content.php
*
* CATEGORY ARCHIVE
* 1 loop-content-category-{CATEGORY-SLUG}.php
* 2 loop-content-category.php
* 3 loop-content-archive.php (common archive template)
* 4 loop-content.php
*
* TAXONOMY ARCHIVE
* 1 loop-content-taxonomy-{taxonomy-name}-{taxonomy-term}.php
* 2 loop-content-taxonomy-{taxonomy-name}.php
* 3 loop-content-taxonomy.php
* 4 loop-content-archive.php (common archive template)
* 5 loop-content.php
*
* TAG ARCHIVE
* 1 loop-content-tag-{tag-slug}.php
* 2 loop-content-tag.php
* 3 loop-content-archive.php (common archive template)
* 4 loop-content.php
*
* DATE ARCHIVE
* 1 loop-content-date-{YEAR}-{MONTH}.php (4 digit year, 2 digit month with leading zero if less than 10)
* 2 loop-content-date-{YEAR}.php (4 digit year)
* 3 loop-content-date.php
* 4 loop-content-archive.php (common archive template)
* 5 loop-content.php
*
* POST ARCHIVE (especially useful for custom post type archives!)
* 1 loop-content-archive-{post-type-slug}.php
* 2 loop-content-archive.php (common archive template)
* 3 loop-content.php
*
* AUTHOR TODO: Do username template drill
* 1 loop-content-author.php
* 2 loop-content.php
*
* HOMEPAGE
* 1 loop-content-home.php
* 2 loop-content.php
*
* SEARCH
* 1 loop-content-search.php
* 2 loop-content.php
*
*
* ATTACHMENT TODO: Basic range of filetypes support
* 1 loop-content-attachment.php
* 2 loop-content.php
*
* PAGE
* 1 loop-content-page.php
* 2 loop-content.php
*
* 404 ERROR PAGE
* 1 loop-content-404.php
* 2 loop-content.php
*
* @since 0.881
* @version 2.1
*
* @param [string] $part REQUIRED The slug name for the generic template
*
* @todo Extend the simple WP core $is_mobile detection
*/
if ( !function_exists( 'wfx_get_template_part' ) ) : function wfx_get_template_part($args) { global $wfx_helper; $wfx_helper->gt_part($args); } endif;
/**
* Gets user role of logged-in user.
* IMPORTANT - Used internally by Wonderflux.
*
* @since 0.62
* @version 2.1
*
* @param [string] $echo Do you want to echo instead of return? Y/N [N]
* @return [string] Current user role, eg 'administrator' or false
*/
if ( !function_exists( 'wfx_user_role' ) ) : function wfx_user_role($args) {
$defaults = array (
'echo' => 'N'
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
global $wfx_helper;
if ($echo == 'N') {
return $wfx_helper->user_role($args);
} else {
echo $wfx_helper->user_role($args);
}
} endif;
/**
* Gets current page 'depth' when using parent/child/grandchild etc page structure.
*
* @since 0.86
* @version 0.92
*
* @param [int] $start Where you would like to start the depth countr from [0]
* @param [string] $show_all Return root level on homepage and search. Y/N [N]
* @return [int] Integer representing depth of page
*/
if ( !function_exists( 'wfx_page_depth' ) ) : function wfx_page_depth($args) { global $wfx_helper; return $wfx_helper->page_depth($args); } endif;
/**
* Get a custom field value for the main queried post.
* Can be used inside or outside the loop.
*
* @since 0.92
* @version 2.1
*
* @param [string] $name REQUIRED The key name of the custom field
* @param [string] $empty If there is no value in custom field, do you want an alternative value? [false]
* @param [string] $escape Do you want the output HTML escaped? - Y/N [N]
* @param [string] $format What type of data is it, do you want to change this date format? - string/date [string]
* @param [string] $date_style PHP date format style [l F j, Y]
* @param [string] $error Do you want something returned on search and 404? - Y/N [N]
* @param [string] $trim Trim white space characters from start and end of custom field value - Y/N [Y]
* @param [int] $id Function usually returns main loop custom field, setting $id forces function to get custom field from specific post ID [false]
* @param [string] $echo Do you want to echo instead of return? - Y/N [N]
* @return [mixed] Custom field value
*/
if ( !function_exists( 'wfx_custom_field' ) ) : function wfx_custom_field($args) {
$defaults = array (
'echo' => 'Y'
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
global $wfx_helper;
if ($echo == 'N') {
return $wfx_helper->custom_field($args);
} else {
echo $wfx_helper->custom_field($args);
}
} endif;
/**
* Returns 'Y' - nothing more, nothing less!
* Useful for setting values ie add_filter( 'wflux_sidebar_1_display', 'wfx__Y' ) in your child theme, saves creating a function
*
* @since 0.93
* @version 0.93
*
* @param none
* @return [string] Y
*/
if ( !function_exists( 'wfx__Y' ) ) : function wfx__Y() { global $wfx_helper; return $wfx_helper->__Y(); } endif;
/**
* Returns 'N' - nothing more, nothing less!
* Useful for setting values ie add_filter( 'wflux_sidebar_1_display', 'wfx__N' ) in your child theme, saves creating a function
*
* @since 0.93
* @version 0.93
*
* @param none
* @return [string] N
*/
if ( !function_exists( 'wfx__N' ) ) : function wfx__N() { global $wfx_helper; return $wfx_helper->__N(); } endif;
/**
* Displays input (or WordPress query information) in a nicer, more useful way for debugging.
* Only displays for logged-in administrator level users by default.
* Contains other powerful query debugging functions.
*
* $input can be set as the following for powerful WordPress debugging:
* wp_query - WordPress $wp_query
* wp_posts - WordPress $posts
* wp_queried - Current queried object
* wp_all_taxonomies - All Taxonomies
*
* @since 1.1
* @version 2.0
*
* @param [mixed] $input REQUIRED What you want to debug!
* @param [string] $label Add a title to top of output to help identify it if using multiple debugs.
* @param [bool] $admin_only Only display to logged-in administrator level users, not other users. true/false [true]
* @param [string] $show_all Only display to supplied WordPress role. true/false [false]
* @param [int] $id Only display to supplied user ID. [false]
*/
if ( !function_exists( 'wfx_debug' ) ) : function wfx_debug($input='',$label='',$admin_only=true,$role=false,$id=false) { global $wfx_helper; $wfx_helper->debug($input,$label,$admin_only,$role,$id); } endif;
/**
* Reveals all Wonderflux hooks available in current view.
*
* When logged in as a user has capability of manage_options (can be override with wflux_debug_show_hooks filter)
* and WF_DEBUG constant defined as true, this plugin reveals the location of all relevant Wonderflux display hooks within your theme.
*
* Filters available:
* wflux_debug_show_hooks - display hooks information to all levels of users instead of those with manage_options capability.
*
* @since 1.2
* @version 1.2
*
* @param none
*/
if ( !function_exists( 'wfx_show_hooks' ) ) : function wfx_show_hooks() { global $wfx_helper; $wfx_helper->show_hooks(); } endif;
/**
* Returns array of common HTML tags to be used with kses or similar.
* Use filter 'wflux_allowed_tags' to mainpulate allowed tags
*
* @since 1.1
* @version 1.1
*
* @param none
* @return [array] Allowed tags array
*/
if ( !function_exists( 'wfx_allowed_tags' ) ) : function wfx_allowed_tags() {
global $wfx_data_manage; return $wfx_data_manage->allowed_tags();
} endif;
/**
* Strips white space and other cruft in html type output
*
* DOES NOT sanitise $input!
*
* @since 1.1
* @version 1.1
*
* @param [int] $input HTML imput
* @return [string] Cleaned-up HTML output
*/
if ( !function_exists( 'wfx_strip_whitespace' ) ) : function wfx_strip_whitespace($input,$echo='N') {
global $wfx_data_manage; return $wfx_data_manage->strip_whitespace($input);
} endif;
/*
#####
# #
#
#####
#
# #
#####
Display functions
*/
/**
* Enables post and site/post comment RSS feed links in head of output.
* THIS IS REQUIRED for WordPress theme repo compliance.
* Easy to remove by remove_theme_support, remove_action, overload function etc!)
*
* @since 1.1
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_core_feed_links' ) ) : function wfx_core_feed_links() { global $wfx_theme_support; $wfx_theme_support->core_feed_links(); } endif;
/**
* Enables title-tag support (available in WordPress 4.1+)
* THIS IS REQUIRED for WordPress theme repo compliance.
* Easy to remove by remove_theme_support, remove_action, overload function etc!)
*
* @since 2.0
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_core_title_tag' ) ) : function wfx_core_title_tag() { global $wfx_theme_support; $wfx_theme_support->core_title_tag(); } endif;
/**
* Core WordPress threaded comment reply Javascript.
* THIS IS REQUIRED for WordPress theme repo compliance.
*
* @since 1.1
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_core_comment_js' ) ) : function wfx_core_comment_js() { global $wfx_theme; $wfx_theme->core_comment_js(); } endif;
// Only need functions if have child theme overrides
if ( WF_THEME_FRAMEWORK_REPLACE == false ) {
/**
* Inserts the core structure static CSS.
* Switches automatically between old pixel based and new Flux Layout systems.
* Set constant WF_THEME_FRAMEWORK_REPLACE to true to remove.
*
* Filters available:
* wflux_css_structure_path - full path to file
* wflux_css_structure_version - version number appended to file
* wflux_css_structure_id - ID of file
*
* @since 0.72
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_css_structure' ) ) : function wfx_display_head_css_structure($args) { global $wfx; $wfx->head_css_structure($args); } endif;
/**
* Inserts the core structure dynamic layout CSS.
* Switches automatically between old pixel based and new Flux Layout systems.
* Set constant WF_THEME_FRAMEWORK_REPLACE to true to remove.
*
* Filters available:
* wflux_css_columns_path - full path to file
* wflux_css_columns_version - version number appended to file
* wflux_css_columns_id - ID of file
* wflux_css_columns_media - Media type
*
* @since 0.72
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_css_columns' ) ) : function wfx_display_head_css_columns() { global $wfx; $wfx->head_css_columns(); } endif;
/**
* Inserts pixel based legacy Internet Explorer CSS (<IE8).
* Only deployed if you are using old pixel based layout system.
* Set constant WF_THEME_FRAMEWORK_REPLACE to true to remove.
* Legacy function - deprecated in Wonderflux 2.0, will likely be removed in the future.
*
* Filters available:
* wflux_css_ie_path - full path to file
* wflux_css_ie_id - ID of file
* wflux_css_ie_media - Media type
*
* @since 0.72
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_css_ie' ) ) : function wfx_display_head_css_ie() { global $wfx; $wfx->head_css_ie(); } endif;
} elseif ( WF_THEME_FRAMEWORK_REPLACE == true ) {
/**
* Replaces framework CSS files (core and dynamic layout system).
* Set constant WF_THEME_FRAMEWORK_REPLACE to true to use.
* Use this to optimise your site - once you have your layout generated you are unlikely to need to change it usually!
*
* Create the following files in your child theme folder (see Wonderflux Advanced tab to generate output):
* - For pixel based system - 'style-framework.css' and optionally 'style-framework-ie.css'.
* - For % based system (Flux Layout) - 'flux-layout-merged.css'.
* If the file exists in your child theme, it will then be added (registered and enqueued) automatically - cool!
*
* Filters available:
* wflux_css_theme_framework_media - Media type
*
* @since 0.93
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_head_css_replace' ) ) : function wfx_head_css_replace($args) { global $wfx; $wfx->head_css_replace($args); } endif;
}
/**
* Setup for WordPress language packs for translators.
* THIS IS REQUIRED for WordPress theme repo compliance.
*
* @since 0.913
* @version 1.1
*
* @param none
*
* @todo EXPERIMENTAL FIRST PASS - needs testing!
*/
if ( !function_exists( 'wfx_config_language' ) ) : function wfx_config_language() { global $wfx_theme; $wfx_theme->language_pack(); } endif;
/**
* Builds the start of the head with doc type declaration.
*
* @since 0.931
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_open' ) ) : function wfx_display_head_open() { global $wfx; $wfx->head_open(); } endif;
/**
* Inserts the Content-Type/charset meta tag.
*
* @since 0.931
* @version 0.931
*
* @param [string] $doctype Document type transitional/strict/frameset/1.1/1.1basic/html5 [transitional]
* @param [string] $content Document content [html]
* @param [string] $charset Character encoding [utf8]
*/
if ( !function_exists( 'wfx_display_head_char_set' ) ) : function wfx_display_head_char_set($args) { global $wfx; $wfx->head_char_set($args); } endif;
/**
* Inserts viewport meta tag.
* Only deployed if you are using new % based layout system (Flux Layout).
*
* Filters available:
* wflux_head_viewport - Viewport meta content.
*
* @since 2.0
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_viewport' ) ) : function wfx_display_head_viewport() { global $wfx; $wfx->head_viewport(); } endif;
/**
* Builds the title in the head of the document.
* BACKPAT: When using WordPress 4.1 or above add_theme_support( 'title-tag' ) is automatically used instead.
*
* @since 0.1
* @version 2.0
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_title' ) ) : function wfx_display_head_title($args) { global $wfx; $wfx->head_title($args); } endif;
/**
* Inserts (enqueue) child theme CSS - style.css
* BACKPAT: When using WordPress 4.1 or above add_theme_support( 'title-tag' ) is automatically used instead.
*
* Filters available:
* wflux_css_theme_id - ID of file (main-theme)
* wflux_css_theme_path - full path to file
* wflux_css_theme_media - Media type
*
* @since 0.72
* @version 1.1
*
* @param none
*/
if ( !function_exists( 'wfx_display_head_css_theme' ) ) : function wfx_display_head_css_theme($args) { global $wfx; $wfx->head_css_theme($args); } endif;
/**
* Adds extra CSS classes to the body tag via WordPress filter.
* Classes added describe your Wonderflux layout config, basic mobile and browser detection.
* Add more classes by using core WordPress filter 'body_class' or override whole function.
*
* Filters available:
* wflux_body_class_browser - Browser detection CSS class output
* wflux_body_class_layout - Wonderflux layout description classes
*
* @since 0.931
* @version 2.1
*
* @param none
*/
if ( !function_exists( 'wfx_display_body_tag' ) ) : function wfx_display_body_tag() { global $wfx; $wfx->body_tag(); } endif;
/**
* A more flexible post_class() function.
* DEPRECIATED - to be removed - use standard WordPress post_class() instead in your template files!
* See wfx_filter_post_class - which filters WP post_class() instead!
*
* NOTES on 'wflux_post_class' filter:
* Use $post_class var in your filter function if you want access to core WP post classes.
* You can then do things like:
* unset($post_class[0]) Remove an item from the array (where [0] is the index/key in the array of WP class values)
* $post_class[] = 'my-new-class' Add an item to the array (Can also be done with the $extra param in function if required - which is simpler!)
*
* Filters available:
* wflux_body_class_browser - Browser detection CSS class output
* wflux_body_class_layout - Wonderflux layout description classes
*
* @since 1.0RC3
* @version 2.1
*
* @param [string] $extra Comma seperated, extra CSS classes you wish to add
* @param [string] $position Position of your additional $extra CSS classes. after/before [after]
* @param [string] $just_string Just string of classes or wrap the output in 'class=""' like normal WordPress? Y/N [N]
* @param [string] $echo Echo or return output. Y/N [Y]
*/
if ( !function_exists( 'wfx_post_class' ) ) : function wfx_post_class($args) {
$defaults = array ( 'echo' => 'Y' );
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
global $wfx;
if ( $echo == 'Y' ) { echo $wfx->post_class($args); }
else { return $wfx->post_class($args); }
} endif;
/**
* Adds extra CSS classes to post class via WordPress filter.
* IMPORTANT - Stop using wfx_post_class() it in your child themes!!
*
* Filters available:
* wflux_post_class_single : Extra CSS class added to a single post view
* wflux_post_class_multiple : Extra CSS class added to multiple post/archive views
* wflux_post_class_first : Extra CSS class added to first post in loop
* wflux_post_class_last : Extra CSS class added to first post in loop
*
* @since 2.1
* @version 2.1
*
* @param none
*/
if ( !function_exists( 'wfx_filter_post_class' ) ) : function wfx_filter_post_class() {
if ( !is_admin() ) {
global $wfx; $wfx->filter_post_class();
}
} endif;
/**
* Displays performance information as a HTML code comment: xx queries in xx seconds.
*
* @since 0.3
* @version 0.931
*
* @param none
*
* @todo Extend with other debug information? wfx_debug() is more useful I guess for this?
*/
if ( !function_exists( 'wfx_debug_performance' ) ) : function wfx_debug_performance() { global $wfx; $wfx->debug_performance(); } endif;
/**
* Output footer HTML code credit comment.
*
* Filters available:
* wflux_comment_code_credit : Text inside code credit
*
* @since 0.71
* @version 2.1
*
* @param none
*/
if ( !function_exists( 'wfx_display_code_credit' ) ) : function wfx_display_code_credit() { global $wfx; $wfx->code_credit(); } endif;
/**
* Output credit in footer of site - show your support and love for WordPress and Wonderflux!
*
* Filters available:
* wflux_footer_credit_format : HTML tag to surround output with.
* wflux_footer_credit_wp : WordPress credit text.
* wflux_footer_divider : Divider between credt text.
* wflux_footer_credit_wf : Wonderflux credit text.
* wflux_footer_credit_content : Entire credit text.
* wflux_footer_credit_div : Surround content with a div?
*
* @since 0.3
* @version 2.1
*
* @param none
* @todo Review code and santization
*/
if ( !function_exists( 'wfx_display_credit' ) ) : function wfx_display_credit($args) { global $wfx; $wfx->display_credit($args); } endif;
/**
* Displays CSS info for designers as a HTML code comment in the <head>.
*
* @since 0.4
* @version 0.931
*
* @param none
*
* @todo Review code and update for Flux Layout - currently only works with old % based layout system.
*/
if ( !function_exists( 'wfx_display_css_info' ) ) : function wfx_display_css_info($args) { global $wfx; $wfx->css_info($args); } endif;
/**
* EXPERIMENTAL - generates a repeating pattern of columns for testing the grid layout system.
*
* @since 1.1
* @version 1.2
*
* @param [int] $rows Maximum number of rows of divs you wish to output.
* @param [string] $type Type of column definitions to use to build output - raw column classes 'columns', or nice definitions 'relative'.
* @param [string] $split Undocumented (sorry - needs testing and code review!)
* @param [string] $compatibility Undocumented (sorry - needs testing and code review!)
*
* @todo Review code and build a bester testing pattern!
*/
if ( !function_exists( 'wfx_display_test_pattern' ) ) : function wfx_display_test_pattern($args) { global $wfx; $wfx->test_pattern($args); } endif;
/**
* Returns saved Wonderflux option value from main options array.
*
* @since 0.93
* @version 0.93
*
* @param [string] $size Option you wish to return. site-width/columns/column-width/sidebar-1-position [site-width]
*
* @todo Build rest of output options.
*/
if ( !function_exists( 'wfx_get_dimensions' ) ) : function wfx_get_dimensions($args) { global $wfx; return $wfx->get_dimensions($args); } endif;
/**
* IMPORTANT - Configures WordPress $content_width.
* Sets the maximum allowed width for any content in the theme, like oEmbeds and images added to posts.
*
* @since 1.1
* @version 1.1
*
* @param none
*
* @todo Check over this functionality, Flux Layout deals with responsive content well already - it's been a while!
*/
if ( !function_exists( 'wfx_content_width_embed' ) ) : function wfx_content_width_embed() { global $wfx; $wfx->content_width_embed(); } endif;
/**
* Includes sidebar template file.
* Uses get_sidebar() and checks for Wonderflux option/filter.
*
* @since 0.93
* @version 0.93
*
* @param none
*
* @todo Check over this functionality, should we be extending get_sidebar() rather than replacing?
*/
if ( !function_exists( 'wfx_get_sidebar' ) ) : function wfx_get_sidebar($args) { global $wfx; $wfx->get_sidebar($args); } endif;
/**
* Creates dynamic CSS grid class definition - used in Wonderflux pixel layout system v1.
* DEPRECIATED in Wonderflux v2.0, will likely be removed in the future!
* Just use the normal CSS classes created by Flux Layout - this is over-engineered!
*
* By using this function to define containers, you can dynamically resize the whole layout.
* The only thing to watch out for is using definitions like:
* - 'quarter' when your columns arent divisible by 4.
* - 'third' when your columns arent divisible by 3.
* - By checking the output of the wf_css_info() function in the head of your document, you can find out lots of useful info!
*
* @since 0.2
* @version 2.0
*
* @param [string] $size Relative size definition to full width of site - eg 'half', 'quarter'. Various values [full]
* @param [string] $class Additional CSS classes. [none]
* @param [string] $id Optional ID. [none]
* @param [string] $last Put on last container inside a row, adds .last CSS class. Y/N [N]
* @param [string] $move Push and pull a div - not used at moment.
* @param [string] $divoutput Wraps output in opening and closing div tags - useful for blocks of code. Y/N [N]
* @param [int] $columns Size of div in columns, overrides $size. [0]
* @param [string] $echo Echo or return output. Y/N [Y]
*
* @todo Remove and move to legacy support plugin.
*/
if ( !function_exists( 'wfx_css' ) ) : function wfx_css($args) {
wp_parse_str($args, $echo_do);
$echo = (isset($echo_do['echo']) && $echo_do['echo'] == 'N') ? 'N' : 'Y';
global $wfx;
if ($echo == 'Y') {
echo $wfx->css($args);
} else {
return $wfx->css($args);
}
} endif;
/**
* Just echos </div> - nothing more nothing less, kinda lazy huh?
* DEPRECIATED in Wonderflux v2.0, will likely be removed in the future!
*
* @since 0.913
* @version 0.913
*
* @param none
*
* @todo Remove and move to legacy support plugin.
*/
if ( !function_exists( 'wfx_css_close' ) ) : function wfx_css_close() { global $wfx; $wfx->css_close(); } endif;
/**
* IMPORTANT - Creates layout wrappers around content and sidebar if begin used.
*
* NOTE: Inserted at hooks priority 2 or 9, to allow you to hook in with your own functions at:
* - priority 1 for before wrappers
* - priority 3+ inside wrappers
*
* @since 0.93
* @version 0.93
*
* @param none
*/
if ( !function_exists( 'wfx_layout_build' ) ) : function wfx_layout_build() { global $wfx; $wfx->layout_build(); } endif;
/**
* IMPORTANT - Adds additional CSS classes to sidebar and content for media query breakpoints.
* Designed to work with Flux Layout - configured in Wonderflux layout options.
*
* Filters available:
* wflux_rwd_full_width : Additional generated CSS classes added to sidebar and main content (in helper function).
*
* @since 2.1
* @version 2.1
*
* @param none
*/
if ( !function_exists( 'wfx_rwd_full_width' ) ) : function wfx_rwd_full_width() { global $wfx; $wfx->rwd_full_width(); } endif;
/**
* Display excerpt of post content inside the loop or custom query.
*
* @since 0.85
* @version 1.1
*
* @param [int] $limit Number of words. [20]
* @param [string] $excerpt_end Characters to add to end of the excerpt. [...]
* @param [string] $trim Trim off punctuation from end of excerpt - good when you don't want it to bump into your excerpt end. Y/N [Y]
* @param [string] $echo Echo or return output. Y/N [Y]
*/
if ( !function_exists( 'wfx_excerpt' ) ) : function wfx_excerpt($args) {
$defaults = array (
'echo' => 'Y'
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
global $wfx;
if ($echo == 'Y') {
echo $wfx->excerpt($args);
} else {
return $wfx->excerpt($args);
}
} endif;
/**
* Displays a single post/page/whatever.
*