function surbma_divi_gravity_forms_enqueue_scripts() { if (wp_basename(get_bloginfo('template_directory')) == 'Divi' && class_exists('GFForms')) { wp_enqueue_style('surbma-divi-gravity-forms-styles', plugins_url('', __FILE__) . '/css/surbma-divi-gravity-forms.css'); $accent_color = esc_html(et_get_option('accent_color', '#2ea3f2')); $all_buttons_font_size = esc_html(et_get_option('all_buttons_font_size', '20')); $all_buttons_text_color = esc_html(et_get_option('all_buttons_text_color', $accent_color)); $all_buttons_text_color_hover = esc_html(et_get_option('all_buttons_text_color_hover', $accent_color)); $all_buttons_bg_color = esc_html(et_get_option('all_buttons_bg_color', '#fff')); $all_buttons_bg_color_hover = esc_html(et_get_option('all_buttons_bg_color_hover', 'rgba(0,0,0,.05)')); $all_buttons_border_width = esc_html(et_get_option('all_buttons_border_width', '2')); $all_buttons_border_color = esc_html(et_get_option('all_buttons_border_color', $accent_color)); $all_buttons_border_color_hover = esc_html(et_get_option('all_buttons_border_color_hover', 'transparent')); $all_buttons_border_radius = esc_html(et_get_option('all_buttons_border_radius', '3')); $all_buttons_border_radius_hover = esc_html(et_get_option('all_buttons_border_radius_hover', '3')); $all_buttons_spacing = esc_html(et_get_option('all_buttons_spacing', '0')); $all_buttons_spacing_hover = esc_html(et_get_option('all_buttons_spacing_hover', '0')); $all_buttons_font_style = esc_html(et_get_option('all_buttons_font_style', '', '', true)); $button_text_style = ''; if ($all_buttons_font_style !== '') { $button_text_style = et_pb_print_font_style($all_buttons_font_style); } $all_buttons_font = esc_html(et_get_option('all_buttons_font', 'inherit')); $custom_css = "body .gform_wrapper .gform_footer input.button,body .gform_wrapper .gform_page_footer input.button{background-color:{$all_buttons_bg_color};color:{$accent_color};border-width:{$all_buttons_border_width}px;border-color:{$all_buttons_border_color};border-radius:{$all_buttons_border_radius}px;font-family:{$all_buttons_font};font-size:{$all_buttons_font_size}px;letter-spacing:{$all_buttons_spacing}px;{$button_text_style}}body .gform_wrapper .gform_footer input.button:hover,body .gform_wrapper .gform_page_footer input.button:hover{background-color:{$all_buttons_bg_color_hover};color:{$all_buttons_text_color_hover};border-color:{$all_buttons_border_color_hover};border-radius:{$all_buttons_border_radius_hover}px;letter-spacing:{$all_buttons_spacing_hover}px;}}"; wp_add_inline_style('surbma-divi-gravity-forms-styles', $custom_css); } }
/** * Outputting saved module styles settings. DRY * * @return void */ function et_pb_print_module_styles_css($section = '', $settings = array()) { // Verify settings if (is_array($settings) && !empty($settings)) { // Loop settings foreach ($settings as $setting) { // settings must have these elements: key, selector, default, and type if (!isset($setting['key']) || !isset($setting['selector']) || !isset($setting['type'])) { continue; } // Some attributes such as shop requires !important tag if (isset($setting['important']) && true === $setting['important']) { $important = ' !important'; } else { $important = ''; } // Prepare the setting key $key = "{$section}-{$setting['key']}"; // Get the value $value = ET_Global_Settings::get_value($key); $default_value = ET_Global_Settings::get_value($key, 'default'); // Output CSS based on its type if (false !== $value && $default_value !== $value) { switch ($setting['type']) { case 'font-size': printf("%s { font-size: %spx%s; }\n", esc_html($setting['selector']), esc_html($value), $important); // Option with specific adjustment for smaller columns $smaller_title_sections = array('et_pb_audio-title_font_size', 'et_pb_blog-header_font_size', 'et_pb_cta-header_font_size', 'et_pb_contact_form-title_font_size', 'et_pb_login-header_font_size', 'et_pb_signup-header_font_size', 'et_pb_slider-header_font_size', 'et_pb_slider-body_font_size', 'et_pb_countdown_timer-header_font_size'); if (in_array($key, $smaller_title_sections)) { // font size coefficient switch ($key) { case 'et_pb_slider-header_font_size': $font_size_coefficient = 0.565217391; // 26/46 break; case 'et_pb_slider-body_font_size': $font_size_coefficient = 0.777777778; // 14/16 break; default: $font_size_coefficient = 0.846153846; // 22/26 break; } printf('.et_pb_column_1_3 %1$s, .et_pb_column_1_4 %1$s { font-size: %2$spx%3$s; }', esc_html($setting['selector']), esc_html($value * $font_size_coefficient), $important); } break; case 'font-size': $value = intval($value); printf(".et_pb_countdown_timer .title { font-size: %spx; }", esc_html($value)); printf(".et_pb_column_3_8 .et_pb_countdown_timer .title, .et_pb_column_1_3 .et_pb_countdown_timer .title, .et_pb_column_1_4 .et_pb_countdown_timer .title { font-size: %spx; }", esc_html($value * (18 / 22))); break; case 'font-style': printf("%s { %s }\n", esc_html($setting['selector']), et_pb_print_font_style($value, $important)); break; case 'color': printf("%s { color: %s%s; }\n", esc_html($setting['selector']), esc_html($value), $important); break; case 'background-color': printf("%s { background-color: %s%s; }\n", esc_html($setting['selector']), esc_html($value), $important); break; case 'border-radius': printf("%s { -moz-border-radius: %spx; -webkit-border-radius: %spx; border-radius: %spx; }\n", esc_html($setting['selector']), esc_html($value), esc_html($value), esc_html($value)); break; case 'width': printf("%s { width: %spx; }\n", esc_html($setting['selector']), esc_html($value)); break; case 'height': printf("%s { height: %spx; }\n", esc_html($setting['selector']), esc_html($value)); break; case 'padding': printf("%s { padding: %spx; }\n", esc_html($setting['selector']), esc_html($value)); break; case 'padding-top-bottom': printf("%s { padding: %spx 0; }\n", esc_html($setting['selector']), esc_html($value)); break; case 'padding-tabs': $padding_tab_top_bottom = intval($value) * 0.133333333; $padding_tab_active_top = $padding_tab_top_bottom + 1; $padding_tab_active_bottom = $padding_tab_top_bottom - 1; $padding_tab_content = intval($value) * 0.8; // negative result will cause layout issue if ($padding_tab_active_bottom < 0) { $padding_tab_active_bottom = 0; } printf(".et_pb_tabs_controls li{ padding: %spx %spx %spx; } .et_pb_tabs_controls li.et_pb_tab_active{ padding: %spx %spx; } .et_pb_all_tabs { padding: %spx %spx; }\n", esc_html($padding_tab_active_top), esc_html($value), esc_html($padding_tab_active_bottom), esc_html($padding_tab_top_bottom), esc_html($value), esc_html($padding_tab_content), esc_html($value)); break; case 'padding-slider': printf("%s { padding-top: %s; padding-bottom: %s }\n", esc_html($setting['selector']), esc_html($value) . '%', esc_html($value) . '%'); if ('et_pagebuilder_slider_padding' === $key) { printf('@media only screen and ( max-width: 767px ) { %1$s { padding-top: %2$s; padding-bottom: %2$s; } }', esc_html($setting['selector']), '16%'); } break; case 'padding-call-to-action': $value = intval($value); printf(".et_pb_promo { padding: %spx %spx !important; }", esc_html($value), esc_html($value * (60 / 40))); printf(".et_pb_column_1_2 .et_pb_promo, .et_pb_column_1_3 .et_pb_promo, .et_pb_column_1_4 .et_pb_promo { padding: %spx; }", esc_html($value)); break; case 'social-icon-size': $icon_margin = intval($value) * 0.57; $icon_dimension = intval($value) * 2; ?> .et_pb_social_media_follow li a.icon{ margin-right: <?php echo esc_html($icon_margin); ?> px; width: <?php echo esc_html($icon_dimension); ?> px; height: <?php echo esc_html($icon_dimension); ?> px; } .et_pb_social_media_follow li a.icon::before{ width: <?php echo esc_html($icon_dimension); ?> px; height: <?php echo esc_html($icon_dimension); ?> px; font-size: <?php echo esc_html($value); ?> px; line-height: <?php echo esc_html($icon_dimension); ?> px; } .et_pb_social_media_follow li a.follow_button{ font-size: <?php echo esc_html($value); ?> px; } <?php break; case 'border-top-style': printf("%s { border-top-style: %s; }\n", esc_html($setting['selector']), esc_html($value)); break; case 'border-top-width': printf("%s { border-top-width: %spx; }\n", esc_html($setting['selector']), esc_html($value)); break; } } } } }