-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
1708 lines (1563 loc) · 77.2 KB
/
functions.php
File metadata and controls
1708 lines (1563 loc) · 77.2 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
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
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
if ( !defined( 'RH_MAIN_THEME_VERSION' ) ) {
define('RH_MAIN_THEME_VERSION', '9.9.6');
}
if(!defined('REHUB_NAME_ACTIVE_THEME')){
define('REHUB_NAME_ACTIVE_THEME', 'REHUB');
}
if(!is_admin()) add_action('init', 'rehub_framework_register_scripts');
if( !function_exists('rehub_framework_register_scripts') ) {
function rehub_framework_register_scripts() {
// Stylesheets
wp_register_style('rhstyle', get_stylesheet_directory_uri() . '/style.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('responsive', get_template_directory_uri() . '/css/responsive.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('rehub_shortcode', get_template_directory_uri() . '/shortcodes/css/css.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('rehubfontawesome', get_template_directory_uri() . '/admin/fonts/fontawesome/font-awesome.min.css', array(), '5.3.1');
wp_register_style( 'rehub-woocommerce', get_template_directory_uri().'/css/woocommerce.css', array(), RH_MAIN_THEME_VERSION, 'all' );
wp_register_style('bbpress_css', get_template_directory_uri() . '/css/bbpresscustom.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('jquery.nouislider', get_template_directory_uri() . '/css/jquery.nouislider.css');
wp_register_style('tabletoggle', get_template_directory_uri() . '/css/tabletoggle.css', array(), '5.0.9');
wp_register_style('eggrehub', get_template_directory_uri() . '/css/eggrehub.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('video-pl', get_template_directory_uri() . '/css/video-playlist.css');
wp_register_style('eddrehub', get_template_directory_uri() . '/css/edd.css');
wp_register_style('rhwcvendor', get_template_directory_uri() . '/css/wcvendor.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('rhwcfmdash', get_template_directory_uri() . '/css/rhwcfmdash.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('rhwcfmstore', get_template_directory_uri() . '/css/rhwcfmstore.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('rhcomparesearch', get_template_directory_uri() . '/css/comparesearch.css', array(), RH_MAIN_THEME_VERSION);
wp_register_style('modulobox', get_template_directory_uri() . '/css/modulobox.min.css', array(), '1.4.4');
//Scripts
wp_register_script('rhinview', get_template_directory_uri() . '/js/inview.js', array('jquery'), '1.0', true);
wp_register_script('rhpgwmodal', get_template_directory_uri() . '/js/pgwmodal.js', array('jquery'), '2.0', true);
wp_register_script('rhunveil', get_template_directory_uri() . '/js/unveil.js', array('jquery'), '1.0', true);
wp_register_script('rhcuttab', get_template_directory_uri() . '/js/cuttabs.js', array('jquery'), '3.3.6', true);
wp_register_script('rhhoverintent', get_template_directory_uri() . '/js/hoverintent.js', array('jquery'), '1.9', true);
wp_register_script('rhniceselect', get_template_directory_uri() . '/js/niceselect.js', array('jquery'), '1.0', true);
wp_register_script('rhcountdown', get_template_directory_uri() . '/js/countdown.js', array('jquery'), '1.0', true);
wp_register_script('rehub', get_template_directory_uri() . '/js/custom.js', array('jquery', 'rhinview', 'rhunveil', 'rhhoverintent', 'rhcountdown'), RH_MAIN_THEME_VERSION, true);
wp_register_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '2.2.2', true);
wp_register_script('totemticker', get_template_directory_uri() . '/js/jquery.totemticker.js', array('jquery'), '', true);
wp_register_script('carouFredSel', get_template_directory_uri() . '/js/jquery.carouFredSel-6.2.1-packed.js', array('jquery'), '6.2.1', true);
wp_register_script('sticky', get_template_directory_uri() . '/js/jquery.sticky.js', array('jquery'), '1.0.5', true);
wp_register_script('custom_scroll', get_template_directory_uri() . '/js/custom_scroll.js', array('jquery', 'rehub'), '1.1', true);
wp_register_script('masonry', get_template_directory_uri() . '/js/masonry.pkgd.min.js', array('jquery'), '3.1.5', true);
wp_register_script('imagesloaded', get_template_directory_uri() . '/js/imagesloaded.pkgd.min.js', array('jquery'), '3.1.8', true);
wp_register_script('masonry_init', get_template_directory_uri() . '/js/masonry_init.js', array('jquery', 'masonry'), '3.1.5', true);
wp_register_script('rh_elparallax', get_template_directory_uri() . '/js/elparallax.js', array('jquery'), '1.0', true);
wp_register_script('jquery.nouislider', get_template_directory_uri() . '/js/jquery.nouislider.full.min.js', array('jquery'), '7.0.0', true);
wp_register_script( 'zeroclipboard', get_template_directory_uri() . '/js/clipboard.min.js', array('jquery'), '1.5.16' );
wp_register_script('wpsm_googlemap', get_template_directory_uri() . '/shortcodes/js/wpsm_googlemap.js', array('jquery'), '', true);
wp_register_script('tipsy', get_template_directory_uri() . '/shortcodes/js/jquery.tipsy.js', array('jquery'), '1.1.0'); // tipsy
wp_register_script('tablesorter', get_template_directory_uri() . '/js/jquery.tablesorter.min.js', array('jquery'), '2.0.2'); // table sorter
wp_register_script('touchswipe', get_template_directory_uri() . '/js/jquery.touchSwipe.min.js', array('jquery'), '2.0.5'); // swiper
wp_register_script('affegg_coupons', get_template_directory_uri() . '/js/affegg_coupons.js', array('jquery'), '1.1.0', true); // affiliate coupons
wp_register_script('owlcarousel', get_template_directory_uri() . '/js/owl.carousel.min.js', array('jquery'), '1.9.9', true);
wp_register_script('video_playlist', get_template_directory_uri() . '/js/video_playlist.js', array('jquery'), '1.0.0', true);
wp_register_script('stickysidebar', get_template_directory_uri() . '/js/stickysidebar.js', array('jquery'), '1.3.1', true);
wp_register_script('printcoupon', get_template_directory_uri() . '/js/printcoupon.js', array('jquery'), '1.0.1', true);
wp_register_script('typehead', get_template_directory_uri() . '/js/typehead.js', array('jquery'), '0.10.5', true);
wp_register_script( 'rehubcompare', get_template_directory_uri() . '/js/comparechart.js', array('jquery', 'rehub'), '1.2', true );
wp_register_script( 'rehubwaypoints', get_template_directory_uri() . '/js/jquery.waypoints.min.js', array('jquery'), '4.0.1', true );
wp_register_script( 'justifygallery', get_template_directory_uri() . '/js/jquery.justifiedGallery.min.js', array('jquery'), '3.6.3', true );
wp_register_script( 'customfloatpanel', get_template_directory_uri() . '/js/custom_floatpanel.js', array('jquery', 'rehub'), '1.0', true );
wp_register_script( 'modulobox', get_template_directory_uri() . '/js/modulobox.min.js', array('jquery'), '1.0.5', true );
wp_register_script( 'rh_elparticle', get_template_directory_uri() . '/js/particles.min.js', array('jquery'), '2.2', true );
wp_register_script( 'gsap', get_template_directory_uri() . '/js/gsap.min.js', array('jquery'), '3.0.5', true );
wp_register_script( 'scrollmagic', get_template_directory_uri() . '/js/ScrollMagic.min.js', array('jquery'), '2.0.7', true );
wp_register_script( 'gsapinit', get_template_directory_uri() . '/js/gsap-init.js', array('jquery','gsap'), '1.1', true );
wp_register_script( 'gsapsplittext', get_template_directory_uri() . '/js/SplitText.min.js', array('jquery','gsap'), '3.0.5', true );
wp_register_script( 'gsapsvgdraw', get_template_directory_uri() . '/js/DrawSVGPlugin.min.js', array('jquery','gsap'), '3.0.5', true );
wp_register_script( 'gsapsvgpath', get_template_directory_uri() . '/js/MotionPathPlugin.min.js', array('jquery','gsap'), '3.0.5', true );
wp_register_script( 'rh_elcanvas', get_template_directory_uri() . '/js/elcanvas.js', array('jquery'), '1.0.0', true );
wp_register_script( 'threejs', get_template_directory_uri() . '/js/three.min.js', array(), '0.112', true );
wp_register_script( 'orbitcontrol', get_template_directory_uri() . '/js/OrbitControls.js', array('threejs'), '1.0', true );
wp_register_script( 'gltfloader', get_template_directory_uri() . '/js/GLTFLoader.js', array('threejs'), '1.0', true );
wp_register_script( 'shaderfrog', get_template_directory_uri() . '/js/shaderfrog.js', array('threejs'), '1.0', true );
wp_register_script( 'gsapthree', get_template_directory_uri() . '/js/gsapthree.js', array('threejs'), '1.0', true );
wp_register_script( 'rhreadingprogress', get_template_directory_uri() . '/js/readingprogress.js', array('jquery', 'rehub'), '1.0.0', true );
}
}
if(!is_admin()) add_action('wp_enqueue_scripts', 'rehub_enqueue_scripts',11);
if( !function_exists('rehub_enqueue_scripts') ) {
function rehub_enqueue_scripts() {
if (rh_check_plugin_active('affiliate-egg/affiliate-egg.php') || defined('\ContentEgg\PLUGIN_PATH')) {wp_enqueue_style('eggrehub');}
wp_enqueue_style('rhstyle');
wp_enqueue_style('responsive');
wp_enqueue_style('rehub_shortcode');
wp_enqueue_style('rehubfontawesome');
wp_enqueue_script('rhinview');
wp_enqueue_script('rhpgwmodal');
wp_enqueue_script('rhunveil');
wp_enqueue_script('rhcuttab');
wp_enqueue_script('rhhoverintent');
wp_enqueue_script('rhniceselect');
wp_enqueue_script('rhcountdown');
wp_enqueue_script('rehub');
if (class_exists('Woocommerce')) {wp_enqueue_style( 'rehub-woocommerce');}
if (defined('wcv_plugin_dir') OR class_exists('WeDevs_Dokan') OR class_exists('WCMp')) {wp_enqueue_style('rhwcvendor');}
if (class_exists('Easy_Digital_Downloads')) {wp_enqueue_style( 'eddrehub');}
if (class_exists('bbPress' )) {wp_enqueue_style('bbpress_css');}
if (rehub_option('rehub_sticky_nav')) {wp_enqueue_script( 'sticky' );}
$translation_array = array(
'back' => esc_html__( 'back', 'rehub-theme' ),
'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
'templateurl' => get_template_directory_uri(),
'fin' => esc_html__( 'That\'s all', 'rehub-theme' ),
'noresults' => esc_html__( 'No results found', 'rehub-theme' ),
'your_rating' => esc_html__( 'Your Rating:', 'rehub-theme' ),
'nonce' => wp_create_nonce('ajaxed-nonce'),
'hotnonce' => wp_create_nonce('hotnonce'),
'wishnonce' => wp_create_nonce('wishnonce'),
'searchnonce' => wp_create_nonce('search-nonce'),
'filternonce' => wp_create_nonce('filter-nonce'),
'rating_tabs_id' => wp_create_nonce('rating_tabs_nonce'),
'max_temp' => REHUB_MAX_TEMP,
'min_temp' => REHUB_MIN_TEMP,
'helpnotnonce' => wp_create_nonce('commre-nonce'),
);
wp_localize_script( 'rehub', 'translation', $translation_array );
$affcoupons_array = array(
'coupontextready' => esc_html__( 'Here is your coupon code', 'rehub-theme' ),
'coupontextcopied' => esc_html__( 'Code is copied', 'rehub-theme' ),
'coupongotowebsite' => esc_html__( 'Go to Website', 'rehub-theme' ),
'couponorcheck' => esc_html__( 'Or check your new window for opened website', 'rehub-theme' ),
);
wp_localize_script( 'affegg_coupons', 'coupvars', $affcoupons_array );
if (is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply');
}
}
if(defined( 'WCFMmp_TOKEN' )){
add_action('after_wcfm_load_styles', 'rh_custom_styles_wcfm_dash');
function rh_custom_styles_wcfm_dash($end_point){
wp_enqueue_style('rhwcfmdash');
}
if(!is_admin()) add_action('wp_enqueue_scripts', 'rh_custom_styles_wcfm_store',99);
function rh_custom_styles_wcfm_store(){
wp_enqueue_style('rhwcfmstore');
}
}
if(!is_admin()) add_action( 'wp_enqueue_scripts', 'rh_optimized_media_styles', 99 );
function rh_optimized_media_styles() {
wp_dequeue_style( 'font-awesome' );
wp_dequeue_style( 'dokan-fontawesome' );
wp_dequeue_style( 'yith-wcwl-font-awesome' );
wp_dequeue_script( 'vc_woocommerce-add-to-cart-js' );
if (rehub_option('disable_woo_scripts')) {
if ( function_exists( 'is_woocommerce' ) ) {
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
# Scripts
wp_dequeue_script( 'wc-add-to-cart' );
wp_dequeue_script( 'wc-cart-fragments' );;
wp_dequeue_script( 'wc-add-to-cart-variation' );
wp_dequeue_script( 'wc-cart' );
wp_dequeue_script( 'woocommerce' );
}
}
}
//wp_dequeue_script( 'jqueryui' );
}
//add helper functions
include (get_template_directory() . '/functions/helper_functions.php');
//Css customizations
if( !function_exists('rehub_custom_css') ) {
function rehub_custom_css() {
return get_template_part('inc/customization');
}
}
add_action( 'wp_head', 'rehub_custom_css' );
function rehub_generate_critical_css(){
if(rehub_option('criticalcss')){
include(rh_locate_template('inc/criticalcss.php'));
}
}
add_action('theme_critical_css', 'rehub_generate_critical_css');
// Add specific CSS class by filter
add_filter('body_class','rehub_body_classes');
function rehub_body_classes($classes) {
if (rehub_option('rehub_body_block')) $classes[] = 'rh-boxed-container';
if (rehub_option('enable_adsense_opt')) $classes[] = 'mediad_layout_enabled';
if (rehub_option('rehub_content_shadow') !='' ){
$classes[] = 'noinnerpadding';
}
// return the $classes array
return $classes;
}
/*** Other essensials ***/
if ( ! isset( $content_width ) ){
$content_width = 840;
}
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'woocommerce');
add_theme_support( 'html5', array( 'search-form' ) );
function rehub_theme_support_add() {
add_theme_support( 'title-tag' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'editor-styles' );
add_theme_support( 'align-wide' );
add_editor_style( 'css/style-editor.css' );
}
add_action( 'after_setup_theme', 'rehub_theme_support_add' );
// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );
//remove some unuseful filter
add_filter( 'term_description', 'shortcode_unautop');
add_filter( 'term_description', 'do_shortcode' );
add_filter('widget_text', 'do_shortcode');
//We disable photon extension as theme has own resizer
if ( class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) {
Jetpack::deactivate_module( 'photon' );
}
add_filter( 'lazyload_is_enabled', '__return_false', 99 );
//////////////////////////////////////////////////////////////////
// Translation
//////////////////////////////////////////////////////////////////
add_action('after_setup_theme', 'rehub_theme_setup');
if( !function_exists('rehub_theme_setup') ) {
function rehub_theme_setup(){
load_theme_textdomain('rehub-theme', get_template_directory() . '/lang');
}
}
//////////////////////////////////////////////////////////////////
// REHub Class for admin and Constants
//////////////////////////////////////////////////////////////////
require_once ( get_template_directory().'/admin/rehub.php');
// Here we populate the font face
$font_face_nav = rehub_option('rehub_nav_font');
if ($font_face_nav){
$font_face_nav_weight = rehub_option('rehub_nav_font_weight');
$font_face_nav_style = rehub_option('rehub_nav_font_style');
$font_face_nav_subset = rehub_option('rehub_nav_font_subset');
if(rehub_option('disable_google_fonts') != true){
VP_Site_GoogleWebFont::instance()->add($font_face_nav, $font_face_nav_weight, $font_face_nav_style, $font_face_nav_subset);
}
}
$font_face_headings = rehub_option('rehub_headings_font');
if($font_face_headings){
$font_face_headings_weight = rehub_option('rehub_headings_font_weight');
$font_face_headings_style = rehub_option('rehub_headings_font_style');
$font_face_headings_subset = rehub_option('rehub_headings_font_subset');
if(rehub_option('disable_google_fonts') != true){
VP_Site_GoogleWebFont::instance()->add($font_face_headings, $font_face_headings_weight, $font_face_headings_style, $font_face_headings_subset);
}
}
$font_face_body = rehub_option('rehub_body_font');
if($font_face_body){
$font_face_body_weight = rehub_option('rehub_body_font_weight');
$font_face_body_style = rehub_option('rehub_body_font_style');
$font_face_body_subset = rehub_option('rehub_body_font_subset');
if(rehub_option('disable_google_fonts') != true){
VP_Site_GoogleWebFont::instance()->add($font_face_body, $font_face_body_weight, $font_face_body_style, $font_face_body_subset);
}
}
// embed font function
function rehub_embed_fonts()
{
if(rehub_option('disable_google_fonts') == true){
if (REHUB_NAME_ACTIVE_THEME == 'REPICK') {
wp_enqueue_style('default_font', get_stylesheet_directory_uri() . '/css/opensans.css');
}elseif(REHUB_NAME_ACTIVE_THEME == 'RETHING'){
wp_enqueue_style('default_font', get_stylesheet_directory_uri() . '/css/localfont.css');
}elseif(REHUB_NAME_ACTIVE_THEME == 'RECART'){
wp_enqueue_style('default_font', get_stylesheet_directory_uri() . '/css/localfont.css');
}
else{
wp_enqueue_style('default_font', get_template_directory_uri() . '/css/roboto.css');
}
}else{
if(rehub_option('disable_default_fonts') != true){
if (REHUB_NAME_ACTIVE_THEME == 'REPICK') {
wp_enqueue_style('default_font', '//fonts.googleapis.com/css?family=Open+Sans:400,700');
}elseif(REHUB_NAME_ACTIVE_THEME == 'RETHING'){
wp_enqueue_style('default_font', '//fonts.googleapis.com/css?family=Noto+Serif:400,700');
wp_enqueue_style('head_nav', '//fonts.googleapis.com/css?family=Montserrat:700');
}elseif(REHUB_NAME_ACTIVE_THEME == 'RECART'){
wp_enqueue_style('default_font', '//fonts.googleapis.com/css?family=Poppins:400,700');
}else{
wp_enqueue_style('default_font', '//fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic');
}
}
}
}
add_action('wp_enqueue_scripts', 'rehub_embed_fonts');
add_action('admin_enqueue_scripts', 'rehub_embed_fonts');
function rehub_resource_hints( $urls, $relation_type ) {
if ( wp_style_is( 'default_font', 'queue' ) && 'preconnect' === $relation_type && rehub_option('disable_google_fonts') != true) {
$urls[] = array(
'href' => 'https://fonts.gstatic.com',
'crossorigin',
);
}
return $urls;
}
add_filter( 'wp_resource_hints', 'rehub_resource_hints', 10, 2 );
//////////////////////////////////////////////////////////////////
// Register WordPress menus
//////////////////////////////////////////////////////////////////
add_action( 'after_setup_theme', 'rehub_register_my_menus' );
if( !function_exists('rehub_register_my_menus') ) {
function rehub_register_my_menus() {
register_nav_menus(
array(
'primary-menu' => esc_html__( 'Primary Menu', 'rehub-theme' ),
'top-menu' => esc_html__( 'Top Menu', 'rehub-theme' ),
'user_logged_in_menu' => esc_html__( 'User Logged In Menu', 'rehub-theme' ),
)
);
}
}
class Rehub_Walker extends Walker_Nav_Menu
{
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="' . esc_attr( $class_names ) . '"';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID );
$item_output .= $args->link_after . '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
}
//Add search and login to the main navigation
add_filter( 'wp_nav_menu_items', 'rehub_add_search_to_main_nav', 20, 4 );
if( ! function_exists( 'rehub_add_search_to_main_nav' ) ) {
function rehub_add_search_to_main_nav( $items, $args ) {
$ubermenu = false;
if( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ubermenu_get_menu_instance_by_theme_location( $args->theme_location ) ) {
// disable on ubermenu navigations
$ubermenu = true;
}
if( $ubermenu == false ) {
if( $args->theme_location == 'primary-menu' && rehub_option('woo_cart_place') == '2' && rehub_option('rehub_header_style') != 'header_seven') {
global $woocommerce;
if ($woocommerce){
$items .= '<li class="menu-item rehub-custom-menu-item rh_woocartmenu">';
$items .= '<a class="rh-header-icon rh-flex-center-align rh_woocartmenu-link cart-contents cart_count_'.$woocommerce->cart->cart_contents_count.'" href="'.wc_get_cart_url().'"><span class="rh_woocartmenu-icon"><span class="rh-icon-notice rehub-main-color-bg">'.$woocommerce->cart->cart_contents_count.'</span></span><span class="rh_woocartmenu-amount">'.$woocommerce->cart->get_cart_total().'</span></a>';
$items .= '</li>';
}
}
if($args->theme_location == 'primary-menu' && rehub_option('rehub_login_icon') == 'menu' && rehub_option('userlogin_enable') == '1') {
$loginurl = (rehub_option('custom_login_url')) ? esc_url(rehub_option('custom_login_url')) : '';
$items .= '<li class="menu-item rehub-custom-menu-item rehub-top-login-onclick">';
$items .= wpsm_user_modal_shortcode(array('wrap'=> 'a', 'loginurl'=>$loginurl));
$items .= '</li>';
}
}
return $items;
}
}
//Add elements to Sliding Mobile Panel
if( ! function_exists( 'rh_custom_sliding_elements' ) ) {
function rh_custom_sliding_elements(){
$slidinglogo = rehub_option('logo_mobilesliding');
$slidingtext = rehub_option('text_mobilesliding');
$output = '';
if($slidingtext || $slidinglogo){
$slidingbg = rehub_option('bg_mobilesliding');
$slidingcolor = rehub_option('color_mobilesliding');
$bgimage = ($slidingbg) ? 'background-image: url('.esc_url($slidingbg).'); background-repeat: repeat; background-position: left top;' : '';
if($slidingcolor){
$bgcolor = 'background-color: '.$slidingcolor.';';
}
elseif(rehub_option("rehub_custom_color") != ''){
$bgcolor = 'background-color: '.rehub_option("rehub_custom_color").';';
}
else{
$bgcolor = 'background-color: #f1f1f1;';
}
$output.= '<div id="rhmobpnlcustom" class="rhhidden"><div id="rhmobtoppnl" style="'.$bgimage.$bgcolor.'" class="pr15 pl15 pb15 pt15">';
if($slidinglogo){
$output.= '<div class="text-center"><a href="'.get_home_url().'"><img id="mobpanelimg" src="'.esc_url($slidinglogo).'" alt="Logo" /></a></div>';
}
if($slidingtext){
$output.= '<div id="mobpaneltext" class="mt15">'.do_shortcode($slidingtext).'</div>';
}
$output.= '</div></div>';
}
return $output;
}
}
//Add elements to footer
function rehub_add_elem_to_footer(){
?>
<?php
if (rehub_option('rehub_logo_inmenu') !='') {
$logoimageurl = '';
if(rehub_option('rehub_logo_inmenu_url') !=''){
$logoimageurl = rehub_option("rehub_logo_inmenu_url");
}
elseif (rehub_option('rehub_logo') !='') {
$logoimageurl = rehub_option('rehub_logo');
}
if ($logoimageurl) {
echo '<div id="logo_mobile_wrapper"><a href="'.get_home_url().'" class="logo_image_mobile"><img src="'.$logoimageurl.'" alt="'.get_bloginfo( "name" ).'" /></a></div>';
}
}
?>
<?php if( rehub_option( 'rehub_logo_retina' ) != '' && rehub_option( 'rehub_logo_retina_width' ) != '' && rehub_option( 'rehub_logo_retina_height' ) !=''): ?>
<?php
$menuscript = '
jQuery(document).ready(function($) {
var retina = window.devicePixelRatio > 1 ? true : false;
if(retina) {
jQuery(".logo_image img").attr("src", "'.rehub_option( "rehub_logo_retina" ).'");
}
});';
wp_add_inline_script('rehub', $menuscript);
?>
<?php endif; ?>
<?php echo rh_custom_sliding_elements();?>
<?php echo coupon_get_code();?>
<?php
if (rehub_option('rehub_analytics')) {
echo rehub_option('rehub_analytics');
}
?>
<?php
}
add_action('wp_footer', 'rehub_add_elem_to_footer');
function add_menu_for_blank(){
echo '<nav class="top_menu"><ul class="menu"><li><a href="/wp-admin/nav-menus.php" target="_blank">Click to Add your menu</a></li></ul></nav>';
}
function add_top_menu_for_blank(){
echo '<div class="top-nav"><ul class="menu"><li></li></ul></div>';
}
add_filter( 'walker_nav_menu_start_el', 'rh_shortcode_in_menu', 20, 2 );
function rh_shortcode_in_menu( $item_output, $item ) {
// Rare case when $item is not an object, usually with custom themes.
if ( ! is_object( $item ) || ! isset( $item->object ) ) {
return $item_output;
}
if ( isset( $item->url ) && ('http://SHORTCODE' === $item->url || 'SHORTCODE' === $item->url || 'https://SHORTCODE' === $item->url) ) {
if(!empty( $item->description)){
$item_output = do_shortcode( $item->description );
}
}
return $item_output;
}
//////////////////////////////////////////////////////////////////
// Resizer
//////////////////////////////////////////////////////////////////
@define('BFITHUMB_UPLOAD_FOLDER', 'thumbs_dir');
require_once('inc/BFI_Thumb.php');
//////////////////////////////////////////////////////////////////
// Post thumbnails
//////////////////////////////////////////////////////////////////
add_action( 'after_setup_theme', 'rehub_image_sizes' );
if ( !function_exists( 'rehub_image_sizes' ) ) {
function rehub_image_sizes() {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 788, 0, true );
}
}
//////////////////////////////////////////////////////////////////
// Resizer function
//////////////////////////////////////////////////////////////////
if( !class_exists('WPSM_image_resizer') ) {
class WPSM_image_resizer{
public $src = '';
public $width = '';
public $height = '';
public $size = 'full';
public $crop = false;
public $lazy = false;
public $title = '';
public $use_thumb = false;
public $no_thumb = '';
public $quality = '100';
function __construct(){ //Enable lazy load when we need
if (rehub_option('enable_lazy_images') == '1'){
$this->lazy = true;
}
}
public function get_resized_url() { //Show resized url with bfi_thumb function
$params = array( 'width' => $this->width, 'height' => $this->height, 'quality' => $this->quality, 'crop' => $this->crop);
$image_url = esc_url($this->src);
if (empty ($this->src) && $this->use_thumb == true) {
$image_url = $this->get_mypost_thumb_url();
if(!rehub_option('rh_image_resize')){
$image_url = bfi_thumb( $image_url, $params );
}
$image_url = apply_filters('rh_thumb_resized_url', $image_url );
}
else {
if(!rehub_option('rh_image_resize')){
$image_url = bfi_thumb( $image_url, $params );
}
$image_url = apply_filters('rh_src_resized_url', $image_url );
}
if (empty($image_url)) {
$image_url = $this->no_thumb();
}
return $image_url;
}
public function get_not_resized_url(){ //Show not resized url of image
$image_url = esc_url($this->src);
if (empty ($this->src) && $this->use_thumb == true) {
$image_url = $this->get_mypost_thumb_url();
}
if (empty($image_url)) {
$image_url = $this->no_thumb();
}
return apply_filters('rh_thumb_notresized_url', $image_url );
}
public function get_mypost_thumb_url() {
global $post ;
$image_url = '';
if (function_exists('_nelioefi_url')){
$image_nelio_url = get_post_meta( $post->ID, _nelioefi_url(), true );
if (!empty($image_nelio_url)){
return apply_filters('rh_thumb_url', $image_nelio_url );
}
}
if ( has_post_thumbnail($post->ID) ){
$image_id = get_post_thumbnail_id($post->ID);
$image_url = wp_get_attachment_image_src($image_id, $this->size);
$image_url = $image_url[0];
return apply_filters('rh_thumb_url', $image_url );
}
return apply_filters('rh_thumb_url', $image_url );
}
public static function get_post_thumb_static($size = 'full'){
global $post ;
$image_url = '';
if (function_exists('_nelioefi_url')){
$image_nelio_url = get_post_meta( $post->ID, _nelioefi_url(), true );
if (!empty($image_nelio_url)){
return apply_filters('rh_thumb_url', $image_nelio_url );
}
}
if ( has_post_thumbnail($post->ID) ){
$image_id = get_post_thumbnail_id($post->ID);
$image_url = wp_get_attachment_image_src($image_id,$size);
$image_url = $image_url[0];
return apply_filters('rh_thumb_url', $image_url );
}
return apply_filters('rh_thumb_url', $image_url );
}
public function no_thumb(){ //Set blank image when no image url found
if(rehub_option('featured_fallback_img')){$image_url = esc_url(rehub_option('featured_fallback_img'));}
else if(!empty($this->no_thumb)){$image_url = $this->no_thumb;}
else {$image_url = get_template_directory_uri() . '/images/default/blank.gif';}
return apply_filters('rh_no_thumb_url', $image_url);
}
public function show_resized_image() {
$width_param = (!empty($this->width)) ? ' width="'.$this->width.'"': '';
$height_param = (!empty($this->height)) ? ' height="'.$this->height.'"': '';
$alt = (!empty($this->title)) ? $this->title : the_title_attribute (array('echo' => 0) );
if ($this->lazy == true){
if(function_exists('is_amp_endpoint') && is_amp_endpoint()){
echo '<img class="lazyimages" data-src="'.$this->get_resized_url().'"'.$width_param.$height_param.' alt="'.the_title_attribute (array('echo' => 0) ).'" src="'.$this->get_resized_url().'" />';
}else{
echo '<img class="lazyimages" data-src="'.$this->get_resized_url().'"'.$width_param.$height_param.' alt="'.the_title_attribute (array('echo' => 0) ).'" src="'.$this->no_thumb().'" />';
}
}
else {
echo '<img src="'.$this->get_resized_url().'"'.$width_param.$height_param.' alt="'.$alt.'" />';
}
}
public function show_not_resized_image() {
$width_param = (!empty($this->width)) ? ' width="'.$this->width.'"': '';
$height_param = (!empty($this->height)) ? ' height="'.$this->height.'"': '';
$alt = (!empty($this->title)) ? $this->title : the_title_attribute (array('echo' => 0) );
if ($this->lazy == true){
if(function_exists('is_amp_endpoint') && is_amp_endpoint()){
echo '<img class="lazyimages" data-src="'.$this->get_not_resized_url().'"'.$width_param.$height_param.' alt="'.the_title_attribute (array('echo' => 0) ).'" src="'.$this->get_not_resized_url().'" />';
}else{
echo '<img class="lazyimages" data-src="'.$this->get_not_resized_url().'"'.$width_param.$height_param.' alt="'.the_title_attribute (array('echo' => 0) ).'" src="'.$this->no_thumb().'" />';
}
}
else {
echo '<img src="'.$this->get_not_resized_url().'"'.$width_param.$height_param.' alt="'.$alt.'" />';
}
}
public static function show_static_resized_image($params = array()) {
$src = $width = $height = $title = $no_thumb_url = $no_thumb_fallback = '';
$crop = $lazy = $thumb = false;
if (rehub_option('enable_lazy_images') == '1'){
$lazy = true;
}
@extract ($params);
$params = array( 'width' => $width, 'height' => $height, 'crop' => $crop);
$no_thumb = (!empty($no_thumb_url)) ? apply_filters('rh_no_thumb_url', $no_thumb_url) : get_template_directory_uri() . '/images/default/blank.gif';
$image_url = esc_url($src);
if (empty($title)) {
$title = the_title_attribute (array('echo' => 0) );
}
if (!empty($image_url)) {
$image_url = bfi_thumb( $image_url, $params );
$image_url = apply_filters('rh_static_resized_url', $image_url);
}
elseif (empty($image_url) && $thumb == true) {
$image_url = self::get_post_thumb_static();
if(!rehub_option('rh_image_resize')){
$image_url = bfi_thumb( $image_url, $params );
}
$image_url = apply_filters('rh_thumb_resized_url', $image_url );
}
if (empty($image_url)) {
if (!empty($no_thumb_fallback)) return $no_thumb_fallback;
$image_url = $no_thumb;
$image_url = apply_filters('rh_no_thumb_url', $image_url);
}
$width_param = (!empty($width)) ? ' width="'.$width.'"': '';
$height_param = (!empty($height)) ? ' height="'.$height.'"': '';
if ($lazy == true){
if(function_exists('is_amp_endpoint') && is_amp_endpoint()){
echo '<img class="lazyimages" data-src="'.$image_url.'"'.$width_param.$height_param.' alt="'.$title.'" src="'.$image_url.'" />';
}else{
echo '<img class="lazyimages" data-src="'.$image_url.'"'.$width_param.$height_param.' alt="'.$title.'" src="'.$no_thumb.'" />';
}
}
else {
echo '<img class="nolazyftheme" src="'.$image_url.'"'.$width_param.$height_param.' alt="'.$title.'" />';
}
}
public static function show_wp_image($image_size='full', $attachment_id = '', $attributes = array()) {
global $post;
$lazy = true;
$lazy = apply_filters('rh_lazy_load', $lazy, $attachment_id);
if (!rehub_option('enable_lazy_images')){
$lazy = false;
}
if(rehub_option('rh_image_resize')){
$image_size='full';
}
$transparent = get_template_directory_uri() . '/images/default/blank.gif';
$image_id = ($attachment_id) ? (int)$attachment_id : get_post_thumbnail_id($post->ID);
$image = wp_get_attachment_image_src($image_id,$image_size);
if(!empty($image)) {
$image_url = $image[0];
}else{
$image_url = '';
}
$image_url = apply_filters('rh_thumb_url', $image_url );
$css_class = (!empty($attributes['css_class'])) ? $attributes['css_class'] : '';
$output = '';
if ($lazy == true){
$alt = trim( strip_tags( get_post_meta($image_id, '_wp_attachment_image_alt', true ) ) );
$alt = apply_filters('wp_get_attachment_alt_attribute', $alt);
if (empty($alt)) {
$alt = the_title_attribute (array('echo' => 0) );
}
if ( has_post_thumbnail($post->ID) ){
$transparent = get_template_directory_uri() . '/images/default/blank.gif';
if ( $attributes ) {
$full_size_image = wp_get_attachment_image_src($image_id, 'full' );
$output = sprintf(
'<img src="%s" data-src="%s" alt="%s" class="lazyimages %s" data-large_image="%s" data-large_image_width="%s" data-large_image_height="%s">',
esc_url( $transparent ),
esc_url( $image_url ),
esc_attr( $alt ),
esc_attr( $css_class ),
esc_attr( $full_size_image[0] ),
esc_attr( $attributes['data-large_image_width'] ),
esc_attr( $attributes['data-large_image_height'] )
);
} else {
$output = sprintf(
'<img src="%s" data-src="%s" alt="%s" class="lazyimages %s" width="%s" height="%s">',
esc_url( $transparent ),
esc_url( $image[0] ),
esc_attr( $alt ),
esc_attr( $css_class ),
esc_attr( $image[1] ),
esc_attr( $image[2] )
);
}
}else{
if(rehub_option('featured_fallback_img')){
$nothumb_url = esc_url(rehub_option('featured_fallback_img'));
}
else if(!empty($attributes['no_thumb'])){
$nothumb_url = esc_url($attributes['no_thumb']);
}
else {
$nothumb_url = get_template_directory_uri() . '/images/default/wooproductph.png';
}
$nothumb_url = apply_filters('rh_no_thumb_url', $nothumb_url);
$output = sprintf(
'<img src="%s" data-src="%s" alt="%s" class="lazyimages %s" width="%s" height="%s">',
esc_url( $transparent ),
esc_url( $nothumb_url),
esc_attr( $alt ),
esc_attr( $css_class ),
esc_attr( $image[1] ),
esc_attr( $image[2] )
);
}
} else {
$attributes['class'] = $css_class;
$output = wp_get_attachment_image( $image_id, $image_size, false, $attributes );
}
$output = apply_filters('rh_thumb_output', $output);
return $output;
}
}}
//////////////////////////////////////////////////////////////////
// Thumbnail function
//////////////////////////////////////////////////////////////////
if( !function_exists('wpsm_thumb') ) {
function wpsm_thumb( $size = 'small', $lazy = true ){
if( $size == 'medium_news' ){$width = 444; $height = 250; $nothumb = get_template_directory_uri() . '/images/default/noimage_432_250.png' ;}
elseif( $size == 'medium_news_s' ){$width = 350; $height = 200; $nothumb = get_template_directory_uri() . '/images/default/noimage_432_250.png' ;}
elseif( $size == 'med_thumbs' ){$width = 123; $height = 90; $nothumb = get_template_directory_uri() . '/images/default/noimage_123_90.png' ;}
elseif( $size == 'news_big' ){$width = 378; $height = 310; $nothumb = get_template_directory_uri() . '/images/default/noimage_378_310.png' ;}
elseif( $size == 'grid_thumb' ){$width = 250; $height = 180; $nothumb = get_template_directory_uri() . '/images/default/noimage_250_180.png' ;}
elseif( $size == 'grid_news' ){$width = 336; $height = 220; $nothumb = get_template_directory_uri() . '/images/default/noimage_336_220.png' ;}
else{ $width = 123; $height = 90; $nothumb = get_template_directory_uri() . '/images/default/noimage_123_90.png' ;}
$showimg = new WPSM_image_resizer();
$showimg->use_thumb = true;
$showimg->no_thumb = $nothumb;
if ($lazy == false) {
$showimg->lazy = false;
}
if( rehub_option( 'rh_image_resize')){
$showimg->size = $size;
$showimg->width = $width;
$showimg->height = $height;
$showimg->show_not_resized_image();
}else{
$showimg->width = $width;
$showimg->height = $height;
$showimg->crop = true;
$showimg->show_resized_image();
}
}
}
//////////////////////////////////////////////////////////////////
// Labels, badges, metas
//////////////////////////////////////////////////////////////////
if( !function_exists('rehub_price_clean') ) {
function rehub_price_clean($price) {
$cur_clean = array('8377', 'Rs.', 'руб.', 'RS.' );
$price = str_replace($cur_clean, '', $price);
if (rehub_option('price_pattern') == 'us') {
$price = (float) preg_replace("/[^0-9\.]/","", $price);
}
elseif (rehub_option('price_pattern') == 'eu') {
$price = preg_replace("/[^0-9,]/","", $price);
$price = (float) str_replace(',', '.', $price);
}
elseif (rehub_option('price_pattern') == 'in') {
$price = (float) preg_replace("/[^0-9\.]/","", $price);
}
else {
$price = (float) preg_replace("/[^0-9\.]/","", $price);
}
if (!is_numeric($price) || $price =='0') {
return;
}
return $price;
}
}
if( !function_exists('rehub_formats_icons') ) {
function rehub_formats_icons($editor='no')
{
global $post;
$offer_price_old = get_post_meta($post->ID, 'rehub_offer_product_price_old', true );
$offer_price_old = apply_filters('rehub_create_btn_price_old', $offer_price_old);
if(!empty($offer_price_old)) {
$offer_price = get_post_meta( $post->ID, 'rehub_offer_product_price', true );
$offer_price = apply_filters('rehub_create_btn_price', $offer_price);
if ( !empty($offer_price)) {
$offer_pricesale = rehub_price_clean($offer_price); //Clean price from currence symbols
$offer_priceold = rehub_price_clean($offer_price_old); //Clean price from currence symbols
if (is_numeric($offer_priceold) && is_numeric($offer_pricesale) && $offer_priceold !=0 && (int)$offer_priceold > (int)$offer_pricesale) {
$off_proc = 0 -(100 - ((int)$offer_pricesale / (int)$offer_priceold) * 100);
$off_proc = round($off_proc);
echo '<span class="overlay_post_formats sale_format"><i class="far fa-tag"></i> <span>'.$off_proc.'%</span></span>';
}
}
}
}
}
if( !function_exists('rehub_format_score') ) {
function rehub_format_score($size = 'small', $type = 'star' )
{
if(vp_metabox('rehub_post.rehub_framework_post_type') == 'review') {
$overall_score_icon = rehub_get_overall_score();
$total = $overall_score_icon * 10;
if ($overall_score_icon !='0' && $overall_score_icon !='') {
if ($type == 'star') {
echo '<div class="star-'.$size.'"><span class="stars-rate"><span style="width: '.$total.'%;"></span></span></div>';
}
elseif ($type == 'square') {
echo '<span class="overlay_post_formats review_formats_score">'.$overall_score_icon.'</span>';
}
elseif ($type == 'line') { ?>
<div class="rate-line rate-line-inner<?php if (rehub_option('color_type_review') == 'multicolor') {echo ' colored_rate_bar';} ?>">
<div class="line" data-percent="<?php echo (int)$total;?>%">
<span class="filled r_score_<?php echo round($overall_score_icon); ?>"><?php echo ''.$overall_score_icon ?></span>
</div>
</div>
<?php
}
}
}
}
}
if( !function_exists('meta_all') ) { //post meta
function meta_all ($time_exist, $cats_exist, $admin_exist, $cats_post = false ){
global $post;
if(rehub_option('exclude_author_meta') != 1 && ($admin_exist != false)){ ?>
<?php $author_id=$post->post_author; ?>
<span class="admin_meta">
<a class="admin" href="<?php echo get_author_posts_url( $author_id ) ?>">
<?php if ($admin_exist === 'full') :?><?php echo get_avatar( $author_id, '22' ); ?><?php endif;?>
<?php the_author_meta( 'display_name', $author_id ); ?>
</a>
</span>
<?php }
if(rehub_option('exclude_date_meta') != 1 && ($time_exist != false)){ ?>
<span class="date_meta"><?php the_modified_time(get_option( 'date_format' )); ?></span>
<?php }
if(rehub_option('exclude_cat_meta') != 1 && ($cats_exist != false) && (!empty($cats_exis))){ ?>
<?php $cat_name = get_cat_name($cats_exist); ?>
<span class="cat_link_meta"><a class="cat" href="<?php echo get_category_link( $cats_exist); ?>"><?php echo ''.$cat_name ?></a></span>
<?php }
if(rehub_option('exclude_cat_meta') != 1 && ($cats_post != false)){
$postidforcat = $post->ID;
if ('post' == $post->post_type) {
$categories = get_the_category($postidforcat);
$separator = ', ';
$output = '';
if ( ! empty( $categories ) ) {
echo '<span class="cat_link_meta">';
foreach( $categories as $category ) {
$output .= '<a class="cat" href="' . esc_url( get_category_link( $category->term_id ) ) . '" title="' . esc_attr( sprintf( esc_html__( 'View all posts in %s', 'rehub-theme' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
}
echo trim( $output, $separator );
echo '</span>';
}
}
elseif ('blog' == $post->post_type) {
$term_list = get_the_term_list( $post->ID, 'blog_category', '<span class="date_meta">', ', ', '</span>' );
if(!is_wp_error($term_list)){
echo ''.$term_list;
}
}
}
}
}
if( !function_exists('rh_post_header_meta') ) { //post meta
function rh_post_header_meta ($admin_exist = true, $time_exist = true, $view_exist = true, $comment_exist = true, $cats_post = true ){
global $post;
if(rehub_option('exclude_author_meta') != 1 && ($admin_exist != false)){ ?>
<?php $author_id=$post->post_author; ?>
<span class="admin_meta">
<a class="admin" href="<?php echo get_author_posts_url( $author_id ) ?>">
<?php if ($admin_exist === 'full') :?><?php echo get_avatar( $author_id, '22' ); ?><?php endif;?>
<?php if ($admin_exist === 'fullbig') :?><?php echo get_avatar( $author_id, '40' ); ?><?php endif;?>
<?php the_author_meta( 'display_name', $author_id ); ?>
</a>
</span>
<?php }
if(rehub_option('exclude_date_meta') != 1 && ($time_exist != false)){ ?>
<span class="date_meta"><?php the_modified_time(get_option( 'date_format' )); ?></span>
<?php }
if(rehub_option('post_view_disable') != 1 && ($view_exist != false) && function_exists('RH_get_post_views')){ ?>
<?php $rehub_views = RH_get_post_views($post->ID); if ($rehub_views !='') :?>
<span class="postview_meta"><?php echo (int)$rehub_views; ?> </span>
<?php endif ;?>
<?php }
if(rehub_option('exclude_comments_meta') != 1 && ($comment_exist != false)){ ?>
<?php if($comment_exist=='compact'):?>
<span class="comm_count_meta"><?php comments_popup_link( esc_html__('0','rehub-theme'), esc_html__('1','rehub-theme'), esc_html__('%','rehub-theme'), 'comm_meta', ''); ?></span>
<?php elseif ($comment_exist == 'compactnoempty'):?>
<?php if($post->comment_count > 0):?>
<span class="comm_count_meta"><?php comments_popup_link( esc_html__('0','rehub-theme'), esc_html__('1','rehub-theme'), esc_html__('%','rehub-theme'), 'comm_meta', ''); ?></span>
<?php endif;?>
<?php else:?>
<span class="comm_count_meta"><?php comments_popup_link( esc_html__('no comments','rehub-theme'), esc_html__('1 comment','rehub-theme'), esc_html__('% comments','rehub-theme'), 'comm_meta', ''); ?></span>
<?php endif;?>
<?php }
if(rehub_option('exclude_cat_meta') != 1 && ($cats_post != false)){
$postidforcat = $post->ID;
if ('post' == $post->post_type) {
$categories = get_the_category($postidforcat);
$separator = ', ';
$output = '';
if ( ! empty( $categories ) ) {
echo '<span class="cat_link_meta">';
foreach( $categories as $category ) {
$output .= '<a class="cat" href="' . esc_url( get_category_link( $category->term_id ) ) . '" title="' . esc_attr( sprintf( esc_html__( 'View all posts in %s', 'rehub-theme' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
}
echo trim( $output, $separator );
echo '</span>';
}
}
elseif ('blog' == $post->post_type) {
$term_list = get_the_term_list( $post->ID, 'blog_category', '<span class="date_meta">', ', ', '</span>' );
if(!is_wp_error($term_list)){
echo ''.$term_list;
}
}
elseif ('product' == $post->post_type) {
$term_list = get_the_term_list( $post->ID, 'product_cat', '<span class="date_meta">', ', ', '</span>' );
if(!is_wp_error($term_list)){
echo ''.$term_list;
}
}