PluginProbe
MotoPress Hotel Booking for Divi / trunk
MotoPress Hotel Booking for Divi vtrunk
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 2.0.0
mphb-divi / src / functions.php

functions.php in MotoPress Hotel Booking for Divi trunk, at src/functions.php

127 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Add customizer styles to <head>
4 */
5 function mphb_divi_customizer_css() {
6 if ( ! function_exists( 'et_get_option' ) ) {
7 return;
8 }
9
10 $button_text_size = absint( et_get_option( 'all_buttons_font_size', '20' ) );
11 $button_text_color = et_get_option( 'all_buttons_text_color', '#ffffff' );
12 $button_bg_color = et_get_option( 'all_buttons_bg_color', 'rgba(0,0,0,0)' );
13 $button_border_width = absint( et_get_option( 'all_buttons_border_width', '2' ) );
14 $button_border_color = et_get_option( 'all_buttons_border_color', '#ffffff' );
15 $button_border_radius = absint( et_get_option( 'all_buttons_border_radius', '3' ) );
16 $button_text_style = et_get_option( 'all_buttons_font_style', '', '', true );
17 $button_spacing = intval( et_get_option( 'all_buttons_spacing', '0' ) );
18 $button_text_color_hover = et_get_option( 'all_buttons_text_color_hover', '#ffffff' );
19 $button_bg_color_hover = et_get_option( 'all_buttons_bg_color_hover', 'rgba(255,255,255,0.2)' );
20 $button_border_color_hover = et_get_option( 'all_buttons_border_color_hover', 'rgba(0,0,0,0)' );
21 $button_border_radius_hover = absint( et_get_option( 'all_buttons_border_radius_hover', '3' ) );
22 $button_spacing_hover = intval( et_get_option( 'all_buttons_spacing_hover', '0' ) );
23
24 ?>
25
26 <style id="mphb-divi-customizer-css">
27 .mphb_sc_rooms-wrapper .button,
28 .mphb_sc_search-wrapper .button,
29 .mphb_sc_search_results-wrapper .button,
30 .mphb_sc_checkout-wrapper .button,
31 .mphb_sc_room-wrapper .button,
32 .mphb_sc_booking_form-wrapper .button,
33 .widget_mphb_rooms_widget .button,
34 .widget_mphb_search_availability_widget form .button,
35 .mphb-booking-form .button{
36 <?php
37 if ( 20 !== $button_text_size ) :
38 ?>
39 font-size: <?php echo absint( $button_text_size ); ?>px;
40 <?php
41 endif;
42 if ( '#ffffff' !== $button_text_color ) :
43 ?>
44 color: <?php echo esc_attr( $button_text_color ); ?>;
45 <?php
46 endif;
47 if ( 'rgba(0,0,0,0)' !== $button_bg_color ) :
48 ?>
49 background: <?php echo esc_attr( $button_bg_color ); ?>;
50 <?php
51 endif;
52 if ( 2 !== $button_border_width ) :
53 ?>
54 border-width: <?php echo absint( $button_border_width ); ?>px !important;
55 <?php
56 endif;
57 if ( '#ffffff' !== $button_border_color ) :
58 ?>
59 border-color: <?php echo esc_attr( $button_border_color ); ?>;
60 <?php
61 endif;
62 if ( 3 !== $button_border_radius ) :
63 ?>
64 border-radius: <?php echo absint( $button_border_radius ); ?>px;
65 <?php
66 endif;
67 if ( '' !== $button_text_style ) :
68 ?>
69 <?php echo esc_html( et_pb_print_font_style( $button_text_style ) ); ?>;
70 <?php
71 endif;
72 if ( 0 !== $button_spacing ) :
73 ?>
74 letter-spacing: <?php echo intval( $button_spacing ); ?>px;
75 <?php
76 endif;
77 if ( function_exists( 'et_pb_get_specific_default_font' ) && 'none' !== et_pb_get_specific_default_font( et_get_option( 'all_buttons_font', 'none' ) ) ) :
78 ?>
79 font-family: <?php echo esc_attr( et_pb_get_specific_default_font( et_get_option( 'all_buttons_font', 'none' ) ) ); ?>, sans-serif;
80 <?php
81 endif;
82 ?>
83 }
84 .mphb_sc_rooms-wrapper .button:hover,
85 .mphb_sc_search-wrapper .button:hover,
86 .mphb_sc_search_results-wrapper .button:hover,
87 .mphb_sc_checkout-wrapper .button:hover,
88 .mphb_sc_room-wrapper .button:hover,
89 .mphb_sc_booking_form-wrapper .button:hover,
90 .widget_mphb_rooms_widget .button:hover,
91 .widget_mphb_search_availability_widget form .button:hover,
92 .mphb-booking-form .button:hover{
93 <?php
94 if ( '#ffffff' !== $button_text_color_hover ) :
95 ?>
96 color: <?php echo esc_attr( $button_text_color_hover ); ?> !important;
97 <?php
98 endif;
99 if ( 'rgba(255,255,255,0.2)' !== $button_bg_color_hover ) :
100 ?>
101 background: <?php echo esc_attr( $button_bg_color_hover ); ?> !important;
102 <?php
103 endif;
104 if ( 'rgba(0,0,0,0)' !== $button_border_color_hover ) :
105 ?>
106 border-color: <?php echo esc_attr( $button_border_color_hover ); ?> !important;
107 <?php
108 endif;
109 if ( 3 !== $button_border_radius_hover ) :
110 ?>
111 border-radius: <?php echo absint( $button_border_radius_hover ); ?>px !important;
112 <?php
113 endif;
114 if ( 0 !== $button_spacing_hover ) :
115 ?>
116 letter-spacing: <?php echo intval( $button_spacing_hover ); ?>px !important;
117 <?php
118 endif;
119 ?>
120 }
121 </style>
122
123 <?php
124 }
125
126 add_action( 'wp_head', 'mphb_divi_customizer_css' );
127