: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'key' => 'header_font_size',
'selector' => '.et_pb_fullwidth_section .et_pb_slide_description .et_pb_slide_title',
'key' => 'body_font_size',
'selector' => '.et_pb_fullwidth_section .et_pb_slide_content',
'type' => 'padding-slider',
'selector' => '.et_pb_fullwidth_section .et_pb_slide_description',
) ); // <<<--------- END MODULE CUSTOMIZER CSS --------->>>
* Filter Module Customizer CSS output.
* @param string $module_customizer_css
$css_output[] = apply_filters( 'et_divi_module_customizer_css_output', ob_get_clean() );
// Give the output to the style manager so a static resource can be created and served.
$styles_manager->set_data( implode( '\n', $css_output ) );
add_action( 'wp', 'et_divi_add_customizer_css' );
* Outputting saved customizer style settings
function et_pb_print_css( $setting ) {
// Parse given settings aginst defaults
$setting = wp_parse_args( $setting, $defaults );
$setting['key'] !== false ||
$setting['selector'] !== false ||
$setting['type'] !== false ||
$setting['settings'] !== false
// Some attribute requires !important tag
if ( $setting['important'] ) {
$important = "!important";
$value = et_get_option( $setting['key'], $setting['default'] );
// Output css based on its type
if ( $value !== false && $value != $setting['default'] ) {
switch ( $setting['type'] ) {
printf( '%1$s { font-size: %2$spx %3$s; }',
esc_html( $setting['selector'] ),
case 'font-size-post-header':
$posts_font_size = intval( $value ) * ( 26 / 30 );
printf( 'body.home-posts #left-area .et_pb_post h2, body.archive #left-area .et_pb_post h2, body.search #left-area .et_pb_post h2 { font-size:%1$spx }
body.single .et_post_meta_wrapper h1 { font-size:%2$spx; }',
esc_html( $posts_font_size ),
esc_html( $setting['selector'] ),
et_pb_print_font_style( $value, $important )
printf( '%1$s { letter-spacing: %2$spx %3$s; }',
esc_html( $setting['selector'] ),
printf( '%1$s { line-height: %2$sem %3$s; }',
esc_html( $setting['selector'] ),
printf( '%1$s { color: %2$s; }',
esc_html( $setting['selector'] ),
printf( '%1$s { background-color: %2$s; }',
esc_html( $setting['selector'] ),
printf( '%1$s { -moz-border-radius: %2$spx; -webkit-border-radius: %2$spx; border-radius: %2$spx; }',
esc_html( $setting['selector'] ),
printf( '%1$s { width: %2$spx; }',
esc_html( $setting['selector'] ),
printf( '%1$s { height: %2$spx; }',
esc_html( $setting['selector'] ),
printf( '%1$s { padding: %2$spx; }',
esc_html( $setting['selector'] ),
case 'padding-top-bottom':
printf( '%1$s { padding: %2$spx 0; }',
esc_html( $setting['selector'] ),
printf( '%1$s { padding: %2$spx %3$spx; }',
esc_html( $setting['selector'] ),
esc_html( ( intval( $value ) * 0.5 ) ),
case 'padding-fullwidth-slider':
printf( '%1$s { padding: %2$s %3$s; }',
esc_html( $setting['selector'] ),
esc_html( $value ) . '%',
printf( '%1$s { padding: %2$s %3$s; }',
esc_html( $setting['selector'] ),
esc_html( $value ) . '%',
esc_html( ( intval( $value ) / 2 ) ) . '%'
$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;
* Outputting saved customizer style(s) settings
function et_pb_print_styles_css( $settings = array() ) {
// $settings should be in array
if ( is_array( $settings ) && ! empty( $settings ) ) {
foreach ( $settings as $setting ) {
et_pb_print_css( $setting );
* Outputting saved module styles settings. DRY
function et_pb_print_module_styles_css( $section = '', $settings = array() ) {
$css = 'et_builder_maybe_wrap_css_selector';
if ( is_array( $settings ) && ! empty( $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'] ) ) {
// Some attributes such as shop requires !important tag
if ( isset( $setting['important'] ) && true === $setting['important'] ) {
$important = ' !important';
// Prepare the setting key
$key = "{$section}-{$setting['key']}";
$value = ET_Global_Settings::get_value( $key );
$default_value = ET_Global_Settings::get_value( $key, 'default' );
$selector = $css( $setting['selector'], false );
// Output CSS based on its type
if ( false !== $value && $default_value !== $value ) {
switch ( $setting['type'] ) {
printf( "%s { font-size: %spx%s; }\n", esc_html( $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 ) ) {
case 'et_pb_slider-header_font_size':
$font_size_coefficient = .565217391; // 26/46
case 'et_pb_slider-body_font_size':
$font_size_coefficient = .777777778; // 14/16
$font_size_coefficient = .846153846; // 22/26
printf( '%1$s { font-size: %2$spx%3$s; }',
esc_html( $css( '.et_pb_column_1_3 ' . $setting['selector'], false ) ),
esc_html( $value * $font_size_coefficient ),
printf( '%1$s { font-size: %2$spx%3$s; }',
esc_html( $css( '.et_pb_column_1_4 ' . $setting['selector'], false ) ),
esc_html( $value * $font_size_coefficient ),
$value = intval( $value );
printf( $css( '.et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value ) );
printf( $css( '.et_pb_column_3_8 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
printf( $css( '.et_pb_column_1_3 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
printf( $css( '.et_pb_column_1_4 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
printf( "%s { %s }\n", esc_html( $selector ), et_pb_print_font_style( $value, $important ) );
printf( "%s { color: %s%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
printf( "%s { background-color: %s%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
printf( "%s { -moz-border-radius: %spx; -webkit-border-radius: %spx; border-radius: %spx; }\n", esc_html( $selector ), esc_html( $value ), esc_html( $value ), esc_html( $value ) );
printf( "%s { width: %spx%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
printf( "%s { height: %spx%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
printf( "%s { padding: %spx; }\n", esc_html( $selector ), esc_html( $value ) );
case 'padding-top-bottom':
printf( "%s { padding: %spx 0; }\n", esc_html( $selector ), esc_html( $value ) );
$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;
"%s { padding: %spx %spx %spx; }\n",
esc_html( $css( '.et_pb_tabs_controls li', false ) ),
esc_html( $padding_tab_active_top ),
esc_html( $padding_tab_active_bottom )
"%s { padding: %spx %spx; }\n",
esc_html( $css( '.et_pb_tabs_controls li.et_pb_tab_active', false ) ),
esc_html( $padding_tab_top_bottom ),
"%s { padding: %spx %spx; }\n",
esc_html( $css( '.et_pb_all_tabs', false ) ),
esc_html( $padding_tab_content ),
printf( "%s { padding-top: %s; padding-bottom: %s }\n", esc_html( $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( $selector ), '16%' );
case 'padding-call-to-action':
$value = intval( $value );
"%s { padding: %spx %spx !important; }\n",
esc_html( $css( '.et_pb_promo', false ) ),
esc_html( $value * ( 60 / 40 ) )
"%s { padding: %spx; }\n",
esc_html( $css( '.et_pb_column_1_2 .et_pb_promo', false ) ),
"%s { padding: %spx; }\n",
esc_html( $css( '.et_pb_column_1_3 .et_pb_promo', false ) ),
"%s { padding: %spx; }\n",
esc_html( $css( '.et_pb_column_1_4 .et_pb_promo', false ) ),
$icon_margin = intval( $value ) * 0.57;
$icon_dimension = intval( $value ) * 2;
<?php echo $css( '.et_pb_social_media_follow li a.icon', false ); ?> {
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;
<?php echo $css( '.et_pb_social_media_follow li a.icon::before', false ); ?> {
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;
<?php echo $css( '.et_pb_social_media_follow li a.follow_button', false ); ?> {
font-size: <?php echo esc_html( $value ); ?>px;
printf( "%s { border-top-style: %s; }\n", esc_html( $selector ), esc_html( $value ) );
printf( "%s { border-top-width: %spx; }\n", esc_html( $selector ), esc_html( $value ) );
* Outputting font-style attributes & values saved by ET_Divi_Font_Style_Option on customizer
function et_pb_print_font_style( $styles = '', $important = '' ) {
if ( '' !== $styles && false !== $styles ) {
// Convert string into array
$styles_array = explode( '|', $styles );
// If $important is in use, give it a space
if ( $important && '' !== $important ) {
$important = " " . $important;
// Use in_array to find values in strings. Otherwise, display default text
if ( in_array( 'bold', $styles_array ) ) {
$font_styles .= "font-weight: bold{$important}; ";
$font_styles .= "font-weight: normal{$important}; ";
if ( in_array( 'italic', $styles_array ) ) {
$font_styles .= "font-style: italic{$important}; ";
$font_styles .= "font-style: normal{$important}; ";