-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfunctions.php
executable file
·990 lines (811 loc) · 31.7 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
<?php
/**
* Theme Functions
*
* Please do not edit this file. This file is part of the Cyber Chimps Framework and all modifications
* should be made in a child theme.
*
* @category CyberChimps Framework
* @package Framework
* @since 1.0
* @author CyberChimps
* @license http://www.opensource.org/licenses/gpl-license.php GPL v3.0 (or later)
* @link http://www.cyberchimps.com/
*/
// Load text domain.
function cyberchimps_text_domain() {
load_theme_textdomain( 'eclipse', get_template_directory() . '/inc/languages' );
}
add_action( 'after_setup_theme', 'cyberchimps_text_domain' );
// Load Core
require_once( get_template_directory() . '/cyberchimps/init.php' );
require_once( get_template_directory() . '/inc/admin-about.php' );
require_once( get_template_directory() . '/inc/testimonial_template.php' );
// Set the content width based on the theme's design and stylesheet.
if( !isset( $content_width ) ) {
$content_width = 640;
} /* pixels */
function cyberchimps_add_site_info() {
?>
<p>© Company Name</p>
<?php
}
add_action( 'cyberchimps_site_info', 'cyberchimps_add_site_info' );
// set up next and previous post links for lite themes only
function cyberchimps_next_previous_posts() {
if( get_next_posts_link() || get_previous_posts_link() ): ?>
<div class="more-content">
<div class="row-fluid">
<div class="span6 previous-post">
<?php previous_posts_link( __( 'Previous Page', 'eclipse' ) ); ?>
</div>
<div class="span6 next-post">
<?php next_posts_link( __( 'Next Page', 'eclipse' ) ); ?>
</div>
</div>
</div>
<?php
endif;
}
add_action( 'cyberchimps_after_content', 'cyberchimps_next_previous_posts' );
if( !function_exists( 'cyberchimps_comment' ) ) :
// Template for comments and pingbacks.
// Used as a callback by wp_list_comments() for displaying the comments.
function cyberchimps_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'eclipse' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'eclipse' ), ' ' ); ?></p>
<?php
break;
default :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment hreview">
<aside class="comment-avatar">
<?php echo get_avatar( $comment, 66 ); ?>
</aside>
<section class="comment-main-container">
<div class="comment-main">
<div class="comment-author reviewer vcard">
<?php printf( '<cite class="fn">%s</cite>', get_comment_author_link() ); ?>
<?php if( $comment->comment_approved == '0' ) : ?>
<span class="comment-moderation">
<em> - <?php _e( 'Your comment is awaiting moderation.', 'eclipse' ); ?></em>
</span>
<?php endif; ?>
</div>
<!-- comment author -->
<div class="comment-meta commentmetadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>" class="dtreviewed">
<time pubdate datetime="<?php comment_time( 'c' ); ?>">
<?php
/* translators: 1: date, 2: time */
printf( __( '%1$s at %2$s', 'eclipse' ), get_comment_date(), get_comment_time() ); ?>
</time>
</a>
<?php edit_comment_link( __( '(Edit)', 'eclipse' ), ' ' ); ?>
<span class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</span><!-- .reply -->
</div>
<!-- .comment-meta .commentmetadata -->
<div class="comment-content"><?php comment_text(); ?></div>
</div>
<!-- comment-main -->
</section>
</article><!-- #comment-## -->
<?php
break;
endswitch;
}
endif; // ends check for cyberchimps_comment()
/* Posted on */
function cyberchimps_posted_on() {
if( is_single() ) {
$show_date = ( cyberchimps_get_option( 'single_post_byline_date', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_date', 1 ) : false;
}
elseif( is_archive() ) {
$show_date = ( cyberchimps_get_option( 'archive_post_byline_date', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_date', 1 ) : false;
}
else {
$show_date = ( cyberchimps_get_option( 'post_byline_date', 1 ) ) ? cyberchimps_get_option( 'post_byline_date', 1 ) : false;
}
if( $show_date ) {
$posted_on = sprintf( '<div class="entry-date updated meta-item"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a></div>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
apply_filters( 'cyberchimps_posted_on', $posted_on );
echo $posted_on;
}
}
/* Posted by */
function cyberchimps_posted_by() {
if( is_single() ) {
$show_author = ( cyberchimps_get_option( 'single_post_byline_author', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_author', 1 ) : false;
}
elseif( is_archive() ) {
$show_author = ( cyberchimps_get_option( 'archive_post_byline_author', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_author', 1 ) : false;
}
else {
$show_author = ( cyberchimps_get_option( 'post_byline_author', 1 ) ) ? cyberchimps_get_option( 'post_byline_author', 1 ) : false;
}
if( $show_author ) {
$posted_by = sprintf( '<div class="entry-author meta-item"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></div>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by', 'eclipse' ) . ' %s', get_the_author() ) ),
esc_html( get_the_author() )
);
apply_filters( 'cyberchimps_posted_by', $posted_by );
echo $posted_by;
}
}
/* Posted in */
function cyberchimps_posted_in() {
global $post;
if( is_single() ) {
$show = ( cyberchimps_get_option( 'single_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_categories', 1 ) : false;
}
elseif( is_archive() ) {
$show = ( cyberchimps_get_option( 'archive_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_categories', 1 ) : false;
}
else {
$show = ( cyberchimps_get_option( 'post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'post_byline_categories', 1 ) : false;
}
if( $show ):
$categories_list = get_the_category_list( ', ' );
if( $categories_list ) :
$cats = $categories_list;
$cats = ' <span class="meta-separator">-<span> ' . $categories_list;
?>
<div class="entry-cats meta-item">
<?php echo apply_filters( 'cyberchimps_post_categories', $cats ); ?>
</div>
<?php endif;
endif;
}
/* Post Tags */
function cyberchimps_post_tags() {
global $post;
if( is_single() ) {
$show = ( cyberchimps_get_option( 'single_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_tags', 1 ) : false;
}
elseif( is_archive() ) {
$show = ( cyberchimps_get_option( 'archive_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_tags', 1 ) : false;
}
else {
$show = ( cyberchimps_get_option( 'post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'post_byline_tags', 1 ) : false;
}
if( $show ):
$tags_list = get_the_tag_list( '', ', ' );
if( $tags_list ) :
$tags = $tags_list;
$tags = ' <span class="meta-separator">-<span> ' . $tags_list;
?>
<div class="entry-tags meta-item">
<?php echo apply_filters( 'cyberchimps_post_tags', $tags ); ?>
</div>
<?php endif; // End if $tags_list
endif;
}
/* Post Comments */
function cyberchimps_post_comments() {
global $post;
if( is_single() ) {
$show = ( cyberchimps_get_option( 'single_post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_comments', 1 ) : false;
}
elseif( is_archive() ) {
$show = ( cyberchimps_get_option( 'archive_post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_comments', 1 ) : false;
}
else {
$show = ( cyberchimps_get_option( 'post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'post_byline_comments', 1 ) : false;
}
$leave_comment = ( is_single() || is_page() ) ? '' : __( 'Leave a comment', 'eclipse' );
if( $show ):
if( !post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
<div class="entry-comments meta-item"><?php comments_popup_link( $leave_comment, __( '1 Comment', 'eclipse' ), '% ' . __( 'Comments', 'eclipse' ) ); ?></div>
<?php endif;
endif;
}
// add single class to post class
function cyberchimps_post_classes( $classes ) {
global $post;
if( is_single( $post->ID ) ) {
$classes[] = 'single';
}
return $classes;
}
add_filter( 'post_class', 'cyberchimps_post_classes' );
// core options customization Names and URL's
//Pro or Free
function cyberchimps_theme_check() {
$level = 'free';
return $level;
}
//Theme Name
function cyberchimps_options_theme_name() {
$text = 'Eclipse 3';
return $text;
}
//Doc's URL
function cyberchimps_options_documentation_url() {
$url = 'http://cyberchimps.com/guides/c-free/';
return $url;
}
// Support Forum URL
function cyberchimps_options_support_forum() {
$url = 'http://cyberchimps.com/forum/free/eclipse/';
return $url;
}
add_filter( 'cyberchimps_current_theme_name', 'cyberchimps_options_theme_name', 1 );
add_filter( 'cyberchimps_documentation', 'cyberchimps_options_documentation_url' );
add_filter( 'cyberchimps_support_forum', 'cyberchimps_options_support_forum' );
// Help Section
function cyberchimps_options_help_header() {
$text = 'Eclipse 3';
return $text;
}
function cyberchimps_options_help_sub_header() {
$text = __( 'Eclipse 3 Responsive WordPress Theme', 'eclipse' );
return $text;
}
add_filter( 'cyberchimps_help_heading', 'cyberchimps_options_help_header' );
add_filter( 'cyberchimps_help_sub_heading', 'cyberchimps_options_help_sub_header' );
// Branding images and defaults
// Banner default
function cyberchimps_banner_default() {
$url = '/images/branding/banner.jpg';
return $url;
}
add_filter( 'cyberchimps_banner_img', 'cyberchimps_banner_default' );
//theme specific skin options in array. Must always include option default
function cyberchimps_skin_color_options( $options ) {
// Get path of image
$imagepath = get_template_directory_uri() . '/inc/css/skins/images/';
$options = array(
'default' => $imagepath . 'default.png'
);
return $options;
}
add_filter( 'cyberchimps_skin_color', 'cyberchimps_skin_color_options', 1 );
//Post format icons default
function cyberchimps_post_format_icons_default() {
$default = 1;
return $default;
}
add_filter( 'cyberchimps_post_format_icons_default', 'cyberchimps_post_format_icons_default' );
// theme specific background images
function cyberchimps_background_image( $options ) {
$imagepath = get_template_directory_uri() . '/cyberchimps/lib/images/';
$options = array(
'none' => $imagepath . 'backgrounds/thumbs/none.png',
'noise' => $imagepath . 'backgrounds/thumbs/noise.png',
'blue' => $imagepath . 'backgrounds/thumbs/blue.png',
'dark' => $imagepath . 'backgrounds/thumbs/dark.png',
'space' => $imagepath . 'backgrounds/thumbs/space.png'
);
return $options;
}
add_filter( 'cyberchimps_background_image', 'cyberchimps_background_image' );
// theme specific typography options
function cyberchimps_typography_sizes( $sizes ) {
$sizes = array( '8', '9', '10', '12', '14', '16', '20' );
return $sizes;
}
function cyberchimps_typography_faces( $faces ) {
$faces = array(
'Arial, Helvetica, sans-serif' => 'Arial',
'Arial Black, Gadget, sans-serif' => 'Arial Black',
'Comic Sans MS, cursive' => 'Comic Sans MS',
'Courier New, monospace' => 'Courier New',
'Georgia, serif' => 'Georgia',
'Impact, Charcoal, sans-serif' => 'Impact',
'Lucida Console, Monaco, monospace' => 'Lucida Console',
'Lucida Sans Unicode, Lucida Grande, sans-serif' => 'Lucida Sans Unicode',
'"Open Sans", sans-serif' => 'Open Sans',
'Palatino Linotype, Book Antiqua, Palatino, serif' => 'Palatino Linotype',
'Tahoma, Geneva, sans-serif' => 'Tahoma',
'Times New Roman, Times, serif' => 'Times New Roman',
'Trebuchet MS, sans-serif' => 'Trebuchet MS',
'Verdana, Geneva, sans-serif' => 'Verdana',
'Symbol' => 'Symbol',
'Webdings' => 'Webdings',
'Wingdings, Zapf Dingbats' => 'Wingdings',
'MS Sans Serif, Geneva, sans-serif' => 'MS Sans Serif',
'MS Serif, New York, serif' => 'MS Serif',
);
return $faces;
}
function cyberchimps_typography_styles( $styles ) {
$styles = array( 'normal' => 'Normal', 'bold' => 'Bold' );
return $styles;
}
function cyberchimps_typography_defaults() {
$defaults = array(
'size' => '14px',
'face' => '"Open Sans", sans-serif',
'style' => 'normal',
'color' => '#cccccc'
);
return $defaults;
}
add_filter( 'cyberchimps_typography_sizes', 'cyberchimps_typography_sizes' );
add_filter( 'cyberchimps_typography_faces', 'cyberchimps_typography_faces' );
add_filter( 'cyberchimps_typography_styles', 'cyberchimps_typography_styles' );
add_filter( 'cyberchimps_typography_defaults', 'cyberchimps_typography_defaults' );
// turn cyberchimps footer link off
function cyberchimps_footer_link() {
$array = array(
'name' => __( 'Cyberchimps Link', 'eclipse' ),
'id' => 'footer_cyberchimps_link',
'std' => 1,
'type' => 'toggle',
'section' => 'cyberchimps_footer_section',
'heading' => 'cyberchimps_footer_heading'
);
return $array;
}
add_filter( 'footer_cyberchimps_link', 'cyberchimps_footer_link' );
function cyberchimps_header_drag_and_drop_options() {
$options = array(
'cyberchimps_logo' => __( 'Logo', 'eclipse' )
);
return $options;
}
add_filter( 'header_drag_and_drop_options', 'cyberchimps_header_drag_and_drop_options', 50 );
function cyberchimps_header_drag_and_drop_default() {
$default = array(
'cyberchimps_logo' => __( 'Logo', 'eclipse' )
);
return $default;
}
add_filter( 'header_drag_and_drop_default', 'cyberchimps_header_drag_and_drop_default', 50 );
// remove fields
function cyberchimps_remove_fields( $orig ) {
$new_fields = cyberchimps_remove_options( $orig, array( 'contact_details', 'searchbar', 'header_banner_image', 'header_banner_url' ) );
return $new_fields;
}
add_filter( 'cyberchimps_field_filter', 'cyberchimps_remove_fields' );
// Remove sections
function cyberchimps_contact_section( $original ) {
$new = cyberchimps_remove_options( $original, array( 'cyberchimps_header_details_section', 'cyberchimps_header_banner_section' ) );
return $new;
}
add_filter( 'cyberchimps_sections_filter', 'cyberchimps_contact_section' );
//upgrade bar
function eclipse_upgrade_title() {
$title = 'Eclipse Pro 3';
return $title;
}
function eclipse_upgrade_link() {
$link = 'http://cyberchimps.com/store/eclipse-pro/';
return $link;
}
add_filter( 'cyberchimps_upgrade_pro_title', 'eclipse_upgrade_title' );
add_filter( 'cyberchimps_upgrade_link', 'eclipse_upgrade_link' );
//setup default drag and drop for blog options
function cyberchimps_default_blog_drag_and_drop() {
$default = array( 'slider_lite' => __( 'Slider Lite', 'eclipse' ),
'portfolio_lite' => __( 'Portfolio Lite', 'eclipse' ),
'blog_post_page' => __( 'Post Page', 'eclipse' )
);
return $default;
}
add_filter( 'cyberchimps_elements_draganddrop_defaults', 'cyberchimps_default_blog_drag_and_drop' );
//setup default slider image 1
function cyberchimps_slider_default_image1() {
return '/images/branding/eclipseslide.jpg';
}
add_filter( 'cyberchimps_slider_lite_img1', 'cyberchimps_slider_default_image1' );
//setup default slider image 2
function cyberchimps_slider_default_image2() {
return '/images/branding/eclipseslide.jpg';
}
add_filter( 'cyberchimps_slider_lite_img2', 'cyberchimps_slider_default_image2' );
//setup default slider image 3
function cyberchimps_slider_default_image3() {
return '/images/branding/eclipseslide.jpg';
}
add_filter( 'cyberchimps_slider_lite_img3', 'cyberchimps_slider_default_image3' );
/* fix full width container that disappears on horizontal scroll */
function cyberchimps_full_width_fix() {
$responsive_design = cyberchimps_get_option( 'responsive_design' );
$min_width = cyberchimps_get_option( 'max_width' );
if( !$responsive_design ) {
$style = '<style rel="stylesheet" type="text/css" media="all">';
$style .= '#footer-widgets-wrapper, #footer-main-wrapper { min-width: ' . $min_width . 'px;}';
$style .= '</style>';
echo $style;
}
}
add_action( 'wp_head', 'cyberchimps_full_width_fix' );
// Additional Options
function cyberchimps_additional_sections( $sections_list ) {
return $sections_list;
}
add_filter( 'cyberchimps_section_list', 'cyberchimps_addon_sections', 20, 1 );
/* Adding thumbnail size for featured image */
add_image_size( 'cyberchimps_thumbnail_new', '264', '150', TRUE );
function cyberchimps_ep_thumbnail_size() {
return 'cyberchimps_thumbnail_new';
}
add_filter( 'cyberchimps_post_thumbnail_size', 'cyberchimps_ep_thumbnail_size' );
// Additional Fields
function cyberchimps_ep_additional_fields( $fields_list ) {
/* Blog posts options */
$fields_list[] = array(
'name' => __( 'Blog Description', 'cyberchimps_core' ),
'id' => 'blog_description',
'type' => 'toggle',
'std' => 0,
'section' => 'cyberchimps_blog_options_section',
'heading' => 'cyberchimps_blog_heading'
);
$fields_list[] = array(
'name' => __( 'Blog Description Text', 'cyberchimps_core' ),
'id' => 'blog_description_text',
'class' => 'blog_description_toggle',
'type' => 'text',
'std' => '',
'section' => 'cyberchimps_blog_options_section',
'heading' => 'cyberchimps_blog_heading'
);
return $fields_list;
}
add_filter( 'cyberchimps_field_list', 'cyberchimps_ep_additional_fields', 20, 1 );
/* Adding mark up for posts page */
function cyberchimps_ep_opening_container() {
echo '<div id="blog-posts-inner-container" class="container-full-width">';
}
add_action( 'cyberchimps_before_content', 'cyberchimps_ep_opening_container', 111 );
/* Adding closing mark up for posts page */
function cyberchimps_ep_closing_container() {
echo '</div>';
}
add_action( 'cyberchimps_after_content', 'cyberchimps_ep_closing_container', 111 );
/* Adding class to display posts in column for Home, Archive */
function cyberchimps_ep_custom_class( $classes ) {
global $post;
$layout_type = '';
if ( is_home() ) {
$layout_type = cyberchimps_get_option( 'sidebar_images', 'right_sidebar' );
if ( strcmp( 'full_width', $layout_type ) == '0' ) {
$classes[] = 'span3';
} else if ( strcmp( 'left_right_sidebar', $layout_type ) == '0' || strcmp( 'content_middle', $layout_type ) == '0' ) {
$classes[] = 'span6';
} else {
$classes[] = 'span4';
}
} elseif ( is_archive() ) {
$layout_type = cyberchimps_get_option( 'archive_sidebar_options', 'right_sidebar' );
if ( strcmp( 'full_width', $layout_type ) == '0' ) {
$classes[] = 'span3';
} else if ( strcmp( 'left_right_sidebar', $layout_type ) == '0' || strcmp( 'content_middle', $layout_type ) == '0' ) {
$classes[] = 'span6';
} else {
$classes[] = 'span4';
}
}
return $classes;
}
/* Seeting posts_per_page option for home page */
function cyberchimps_ep_posts_per_page_home( $query ) {
if ( $query->is_home() && ! is_admin() && $query->is_main_query() ) {
$layout_type = cyberchimps_get_option( 'sidebar_images', 'right_sidebar' );
if ( strcmp( 'full_width', $layout_type ) == '0' ) {
$query->set( 'posts_per_page', 4 );
} else if ( strcmp( 'left_right_sidebar', $layout_type ) == '0' || strcmp( 'content_middle', $layout_type ) == '0' ) {
$query->set( 'posts_per_page', 2 );
} else {
$query->set( 'posts_per_page', 3 );
}
}
return $query;
}
add_action( 'pre_get_posts', 'cyberchimps_ep_posts_per_page_home' );
/* Displayed blog description */
function cyberchimps_ep_blog_description() {
$html = '';
$title_text = cyberchimps_get_option( 'blog_title_text', __( 'Our Blog', 'cyberchimps_core' ) );
$blog_description = cyberchimps_get_option( 'blog_description' );
$blog_description_text = cyberchimps_get_option( 'blog_description_text' );
$html = '<div id="cyberchimps_blog_title" class="row-fluid">
<header class="page-header">
<h1 class="page-title">' . $title_text . '</h1>
</header>';
if ( ! empty( $blog_description ) && ! empty( $blog_description_text ) ) {
$html .= '<div id="cyberchimps_blog_description">' . $blog_description_text . '</div>';
}
$html .= '</div>';
return $html;
}
add_filter( 'cyberchimps_blog_title_html', 'cyberchimps_ep_blog_description' );
// Remove searchbar from customizer
add_action( 'customize_register', 'eclipse_customize_register', 50 );
function eclipse_customize_register( $wp_customize ) {
$wp_customize->remove_setting( 'cyberchimps_options[searchbar]' );
$wp_customize->remove_control( 'searchbar' );
}
// default background color
function eclipse_default_background_color() {
$color = '333333';
return $color;
}
add_filter( 'default_background_color', 'eclipse_default_background_color' , '11');
function cyberchimps_eclipse_upgrade_bar(){
$upgrade_link = apply_filters( 'cyberchimps_upgrade_link', 'http://cyberchimps.com' );
$pro_title = apply_filters( 'cyberchimps_upgrade_pro_title', 'CyberChimps Pro' );
?>
<br>
<div class="upgrade-callout">
<p><img src="<?php echo get_template_directory_uri(); ?>/cyberchimps/options/lib/images/chimp.png" alt="CyberChimps"/>
<?php printf(
__( 'Welcome to Eclipse 3! Get 30%% off on %1$s using Coupon Code <span style="color:red">ECLIPSE30</span>', 'cyberchimps_core' ),
'<a href="' . $upgrade_link . '" target="_blank" title="' . $pro_title . '">' . $pro_title . '</a> '
); ?>
</p>
<div class="social-container">
<div class="social">
<a href="https://twitter.com/cyberchimps" class="twitter-follow-button" data-show-count="false" data-size="small">Follow @cyberchimps</a>
<script>!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");</script>
</div>
<div class="social">
<iframe
src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fcyberchimps.com%2F&send=false&layout=button_count&width=200&show_faces=false&action=like&colorscheme=light&font&height=21"
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe>
</div>
</div>
</div>
<h4 class="notice notice-info is-dismissible" style="margin-top:15px;">
<p>
<?php
$utm_link="https://cyberchimps.com/free-download-50-stock-images-use-please/?utm_source=Eclipse";
$utm_text="Get 50 Free High-Resolution Stock Images by CyberChimps";
printf('<a href="' . $utm_link . '" target="_blank">' . $utm_text . '</a> ');
?>
</p>
</h4>
<?php
}
add_action('admin_init','remove_upgrade_bar');
function remove_upgrade_bar(){
remove_action( 'cyberchimps_options_before_container', 'cyberchimps_upgrade_bar');
}
if( cyberchimps_theme_check() == 'free' ) {
add_action( 'cyberchimps_options_before_container', 'cyberchimps_eclipse_upgrade_bar' );
}
/**p_e
* [eclipse_title_setup description].
*/
function eclipse_title_setup() {
// enabling theme support for title tag.
add_theme_support( 'title-tag' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Adds support for editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'White', 'eclipse' ),
'slug' => 'white',
'color' => '#fff',
),
array(
'name' => __( 'Light gray', 'eclipse' ),
'slug' => 'light-gray',
'color' => '#f5f5f5',
),
array(
'name' => __( 'Blue', 'eclipse' ),
'slug' => 'blue',
'color' => '#337ab7',
),
array(
'name' => __( 'Dark gray', 'eclipse' ),
'slug' => 'dark-gray',
'color' => '#333',
),
)
);
}
add_action( 'after_setup_theme', 'eclipse_title_setup' );
/**
* [customizer_css description].
*
* @return string.
*/
function customizer_css() {
$typography_options = cyberchimps_get_option( 'typography_options' );
$font_family_headings = cyberchimps_get_option( 'font_family_headings' );
$font_family = $typography_options['face'] ? $typography_options['face'] : 'Open Sans", Helvetica, Arial, "Arial, Helvetica, sans-serif';
$font_size = $typography_options['size'] ? $typography_options['size'] : '14px';
$font_weight = $typography_options['style'] ? $typography_options['style'] : 'Normal';
$color = cyberchimps_get_option( 'text_colorpicker' ) ? cyberchimps_get_option( 'text_colorpicker' ) : '#cccccc';
$link_colorpicker = cyberchimps_get_option( 'link_colorpicker' ) ? cyberchimps_get_option( 'link_colorpicker' ) : '#ffffff';
$link_hover_colorpicker = cyberchimps_get_option( 'link_hover_colorpicker' ) ? cyberchimps_get_option( 'link_hover_colorpicker' ) : '#005580';
$eclipse_font_family_headings = $font_family_headings['face'] ? $font_family_headings['face'] : 'Arial, Helvetica, sans-serif';
$get_background_color = get_background_color() ? get_background_color() : 'fff';
$get_background_image1 = get_template_directory_uri() . '/cyberchimps/lib/images/backgrounds/' . get_theme_mod( 'cyberchimps_background' ) . '.jpg';
$get_background_image1 = $get_background_image1 ? $get_background_image1 : '';
$get_background_image2 = get_background_image() ? get_background_image() : '';
$get_background_image = $get_background_image2 ? $get_background_image2 : $get_background_image1;
$custom_css = ".editor-writing-flow,
.editor-styles-wrapper{
background-color:#{$get_background_color};
background-image:url('{$get_background_image}');
font-family: {$font_family};
font-size: {$font_size};
font-weight: {$font_weight};
color: {$color};
line-height: 1.5;
}
.wp-block-freeform.block-library-rich-text__tinymce h1,
.wp-block-freeform.block-library-rich-text__tinymce h2,
.wp-block-freeform.block-library-rich-text__tinymce h3,
.wp-block-freeform.block-library-rich-text__tinymce h4,
.wp-block-freeform.block-library-rich-text__tinymce h5,
.wp-block-freeform.block-library-rich-text__tinymce h6,
.wp-block-heading h1.editor-rich-text__tinymce,
.wp-block-heading h2.editor-rich-text__tinymce,
.wp-block-heading h3.editor-rich-text__tinymce,
.wp-block-heading h4.editor-rich-text__tinymce,
.wp-block-heading h5.editor-rich-text__tinymce,
.wp-block-heading h6.editor-rich-text__tinymce {
font-family: {$eclipse_font_family_headings};
font-weight: normal;
margin-bottom: 15px;
}
.wp-block-freeform.block-library-rich-text__tinymce a,
.editor-writing-flow a{
color: {$link_colorpicker};
text-decoration: none;
}
.wp-block-freeform.block-library-rich-text__tinymce a:hover,
.wp-block-freeform.block-library-rich-text__tinymce a:focus,
.editor-writing-flow a:hover,
.editor-writing-flow a:focus{
color: {$link_hover_colorpicker};
}";
return $custom_css;
}
/**
* Enqueue block styles in editor
*/
function eclipse_block_styles() {
wp_enqueue_style( 'eclipse-google-font', 'https://fonts.googleapis.com/css?family=Open+Sans|Titillium+Web|Lobster', array(), '1.0' );
wp_add_inline_style( 'eclipse-google-font', customizer_css() );
wp_enqueue_style( 'eclipse-gutenberg-blocks', get_stylesheet_directory_uri() . '/inc/css/gutenberg-blocks.css', array(), '1.0' );
}
add_action( 'enqueue_block_editor_assets', 'eclipse_block_styles' );
/**
* [eclipse_enqueue description]
*
* @return void
*/
function eclipse_enqueue() {
$directory_uri = get_template_directory_uri();
wp_enqueue_script( 'jquery-flexslider', $directory_uri . '/inc/js/jquery.flexslider.js', 'jquery', '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'eclipse_enqueue' );
/**
* [eclipse_set_defaults description]
*/
function eclipse_set_defaults() {
remove_action('testimonial', array( CyberChimpsTestimonial::instance(), 'render_display' ));
add_action('testimonial', 'eclipse_testimonial_render_display');
}
add_action( 'init', 'eclipse_set_defaults' );
function eclipse_customize_edit_links( $wp_customize ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a'
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.top-head-description'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[custom_logo]', array(
'selector' => '#logo'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[theme_backgrounds]', array(
'selector' => '#social'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[searchbar]', array(
'selector' => '#navigation #searchform'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_show_toggle]', array(
'selector' => '#footer_wrapper'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_copyright_text]', array(
'selector' => '#copyright'
) );
$wp_customize->selective_refresh->add_partial( 'nav_menu_locations[primary]', array(
'selector' => '#navigation .nav'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[blog_title]', array(
'selector' => '.page-title'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_show_toggle]', array(
'selector' => '#footer-widget-container'
) );
}
add_action( 'customize_register', 'eclipse_customize_edit_links' );
add_theme_support( 'customize-selective-refresh-widgets' );
add_action( 'admin_notices', 'eclipse_admin_notices' );
function eclipse_admin_notices()
{
$admin_check_screen = get_admin_page_title();
if( !class_exists('SlideDeckPlugin') )
{
$plugin='slidedeck/slidedeck.php';
$slug = 'slidedeck';
$installed_plugins = get_plugins();
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-info is-dismissible" style="margin-top:15px;">
<p>
<?php if( isset( $installed_plugins[$plugin] ) )
{
?>
<a href="<?php echo admin_url( 'plugins.php' ); ?>">Activate the SlideDeck Lite plugin</a>
<?php
}
else
{
?>
<a href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); ?>">Install the SlideDeck Lite plugin</a>
<?php } ?>
</p>
</div>
<?php
}
}
if( !class_exists('WPForms') )
{
$plugin = 'wpforms-lite/wpforms.php';
$slug = 'wpforms-lite';
$installed_plugins = get_plugins();
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-info is-dismissible" style="margin-top:15px;">
<p>
<?php if( isset( $installed_plugins[$plugin] ) )
{
?>
<a href="<?php echo admin_url( 'plugins.php' ); ?>">Activate the WPForms Lite plugin</a>
<?php
}
else
{
?>
<a href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); ?>">Install the WP Forms Lite plugin</a>
<?php } ?>
</p>
</div>
<?php
}
}
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-success is-dismissible">
<b><p>Liked this theme? <a href="https://wordpress.org/support/theme/eclipse/reviews/#new-post" target="_blank">Leave us</a> a ***** rating. Thank you! </p></b>
</div>
<?php
}
}