PluginProbe
BH Custom CSS3 Preloader – Just play and play / 2.2
BH Custom CSS3 Preloader – Just play and play v2.2
trunk 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8
bh-custom-preloader / preloader.php

preloader.php in BH Custom CSS3 Preloader – Just play and play 2.2, at preloader.php

115 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // A Custom function for get an option
4 if ( ! function_exists( 'bh_get_option' ) ) {
5 function bh_get_option( $option = '', $default = null ) {
6 $options = get_option( 'bh_preloader' ); // Attention: Set your unique id of the framework
7 return ( isset( $options[$option] ) ) ? $options[$option] : $default;
8 }
9 }
10
11
12
13 // Adding Preloader
14 function bh_custom_preloader_section(){
15
16 $preloader_opt = bh_get_option('bh-preloader-opt');
17 $preloader_homepage_opt = bh_get_option('bh-preloader-homepage-opt');
18 $preloader_type = bh_get_option('bh-preloader-type');
19 $image_preloaders = bh_get_option('bh-image-preloaders');
20
21
22
23 if($preloader_opt == true){
24
25 if($preloader_type == 'pre-1'){
26 if($preloader_homepage_opt == true){
27 if(is_front_page()){ ?>
28 <!-- START PRELOADER -->
29 <div class="preloader">
30 <div class="status" style="background-image: url(<?php echo esc_url(BHPREDIRURI . 'img/'. $image_preloaders . '.gif');?>); background-position: center; background-repeat: no-repeat;"></div>
31 </div>
32 <!-- END PRELOADER -->
33 <?php } ?>
34 <?php }else{ ?>
35 <!-- START PRELOADER -->
36 <div class="preloader">
37 <div class="status" style="background-image: url(<?php echo esc_url(BHPREDIRURI . 'img/'. $image_preloaders . '.gif');?>); background-position: center; background-repeat: no-repeat;"></div>
38 </div>
39 <!-- END PRELOADER -->
40 <?php } ?>
41 <?php
42
43 }else{
44 if($preloader_homepage_opt == true){
45 if(is_front_page()){ ?>
46 <!-- START PRELOADER -->
47 <div class="preloader">
48 <div class="spinner">
49 <div class="double-bounce1"></div>
50 <div class="double-bounce2"></div>
51 </div>
52 </div>
53 <!-- END PRELOADER -->
54 <?php } ?>
55
56 <?php }else{?>
57 <!-- START PRELOADER -->
58 <div class="preloader">
59 <div class="spinner">
60 <div class="double-bounce1"></div>
61 <div class="double-bounce2"></div>
62 </div>
63 </div>
64 <!-- END PRELOADER -->
65 <?php }
66
67 }
68 }
69 }
70 add_action('wp_footer' , 'bh_custom_preloader_section');
71
72 // Adding Preloader options css
73 function bh_custom_preloader_option_css(){
74 $preloader_bg_color = bh_get_option('bh-preloader-bg-color');
75 $preloader_opacity = bh_get_option('bh-opacity');
76 $preloader_color = bh_get_option('bh-preloader-color');
77
78 ?>
79
80 <style type="text/css">
81 .preloader{
82 background-color: <?php echo esc_attr($preloader_bg_color); ?>;
83 opacity: <?php echo esc_attr($preloader_opacity); ?>;
84 }
85 .double-bounce1,
86 .double-bounce2 {
87 background-color:<?php echo esc_attr($preloader_color); ?>;
88 }
89
90 </style>
91 <?php
92 }
93 add_action('wp_head' , 'bh_custom_preloader_option_css');
94
95 // Adding Preloader Active jQuery
96 function bhcustom_preloader_js(){
97 $preloader_delay_time = bh_get_option('bh-delay-time');
98 ?>
99
100 <script type="text/javascript">
101
102 /*PRELOADER JS*/
103 jQuery(window).on('load', function() {
104 jQuery('.spinner').fadeOut();
105 jQuery('.preloader').delay(<?php echo esc_js($preloader_delay_time);?>).fadeOut('slow');
106 });
107 /*END PRELOADER JS*/
108
109 </script>
110
111 <?php
112 }
113 add_action('wp_footer' , 'bhcustom_preloader_js');
114
115