Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi
File: functions.php
$icon_dimension = intval( $value ) * 2;
[7000] Fix | Delete
?>
[7001] Fix | Delete
.et_pb_social_media_follow li a.icon{
[7002] Fix | Delete
margin-right: <?php echo esc_html( $icon_margin ); ?>px;
[7003] Fix | Delete
width: <?php echo esc_html( $icon_dimension ); ?>px;
[7004] Fix | Delete
height: <?php echo esc_html( $icon_dimension ); ?>px;
[7005] Fix | Delete
}
[7006] Fix | Delete
[7007] Fix | Delete
.et_pb_social_media_follow li a.icon::before{
[7008] Fix | Delete
width: <?php echo esc_html( $icon_dimension ); ?>px;
[7009] Fix | Delete
height: <?php echo esc_html( $icon_dimension ); ?>px;
[7010] Fix | Delete
font-size: <?php echo esc_html( $value ); ?>px;
[7011] Fix | Delete
line-height: <?php echo esc_html( $icon_dimension ); ?>px;
[7012] Fix | Delete
}
[7013] Fix | Delete
<?php
[7014] Fix | Delete
break;
[7015] Fix | Delete
}
[7016] Fix | Delete
}
[7017] Fix | Delete
}
[7018] Fix | Delete
}
[7019] Fix | Delete
[7020] Fix | Delete
/**
[7021] Fix | Delete
* Outputting saved customizer style(s) settings
[7022] Fix | Delete
*/
[7023] Fix | Delete
function et_pb_print_styles_css( $settings = array() ) {
[7024] Fix | Delete
[7025] Fix | Delete
// $settings should be in array
[7026] Fix | Delete
if ( is_array( $settings ) && ! empty( $settings ) ) {
[7027] Fix | Delete
[7028] Fix | Delete
// Loop settings
[7029] Fix | Delete
foreach ( $settings as $setting ) {
[7030] Fix | Delete
[7031] Fix | Delete
// Print css
[7032] Fix | Delete
et_pb_print_css( $setting );
[7033] Fix | Delete
[7034] Fix | Delete
}
[7035] Fix | Delete
}
[7036] Fix | Delete
}
[7037] Fix | Delete
[7038] Fix | Delete
/**
[7039] Fix | Delete
* Outputting saved module styles settings. DRY
[7040] Fix | Delete
*
[7041] Fix | Delete
* @return void
[7042] Fix | Delete
*/
[7043] Fix | Delete
function et_pb_print_module_styles_css( $section = '', $settings = array() ) {
[7044] Fix | Delete
$css = 'et_builder_maybe_wrap_css_selector';
[7045] Fix | Delete
[7046] Fix | Delete
// Verify settings
[7047] Fix | Delete
if ( is_array( $settings ) && ! empty( $settings ) ) {
[7048] Fix | Delete
[7049] Fix | Delete
// Loop settings
[7050] Fix | Delete
foreach ( $settings as $setting ) {
[7051] Fix | Delete
[7052] Fix | Delete
// settings must have these elements: key, selector, default, and type
[7053] Fix | Delete
if ( ! isset( $setting['key'] ) ||
[7054] Fix | Delete
! isset( $setting['selector'] ) ||
[7055] Fix | Delete
! isset( $setting['type'] ) ) {
[7056] Fix | Delete
continue;
[7057] Fix | Delete
}
[7058] Fix | Delete
[7059] Fix | Delete
// Some attributes such as shop requires !important tag
[7060] Fix | Delete
if ( isset( $setting['important'] ) && true === $setting['important'] ) {
[7061] Fix | Delete
$important = ' !important';
[7062] Fix | Delete
} else {
[7063] Fix | Delete
$important = '';
[7064] Fix | Delete
}
[7065] Fix | Delete
[7066] Fix | Delete
// Prepare the setting key
[7067] Fix | Delete
$key = "{$section}-{$setting['key']}";
[7068] Fix | Delete
[7069] Fix | Delete
// Get the value
[7070] Fix | Delete
$value = ET_Global_Settings::get_value( $key );
[7071] Fix | Delete
$default_value = ET_Global_Settings::get_value( $key, 'default' );
[7072] Fix | Delete
[7073] Fix | Delete
// Format the selector.
[7074] Fix | Delete
$selector = $css( $setting['selector'], false );
[7075] Fix | Delete
[7076] Fix | Delete
// Output CSS based on its type
[7077] Fix | Delete
if ( false !== $value && $default_value !== $value ) {
[7078] Fix | Delete
[7079] Fix | Delete
switch ( $setting['type'] ) {
[7080] Fix | Delete
case 'font-size':
[7081] Fix | Delete
[7082] Fix | Delete
printf( "%s { font-size: %spx%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
[7083] Fix | Delete
[7084] Fix | Delete
// Option with specific adjustment for smaller columns
[7085] Fix | Delete
$smaller_title_sections = array(
[7086] Fix | Delete
'et_pb_audio-title_font_size',
[7087] Fix | Delete
'et_pb_blog-header_font_size',
[7088] Fix | Delete
'et_pb_cta-header_font_size',
[7089] Fix | Delete
'et_pb_contact_form-title_font_size',
[7090] Fix | Delete
'et_pb_login-header_font_size',
[7091] Fix | Delete
'et_pb_signup-header_font_size',
[7092] Fix | Delete
'et_pb_slider-header_font_size',
[7093] Fix | Delete
'et_pb_slider-body_font_size',
[7094] Fix | Delete
'et_pb_countdown_timer-header_font_size',
[7095] Fix | Delete
);
[7096] Fix | Delete
[7097] Fix | Delete
if ( in_array( $key, $smaller_title_sections ) ) {
[7098] Fix | Delete
[7099] Fix | Delete
// font size coefficient
[7100] Fix | Delete
switch ( $key ) {
[7101] Fix | Delete
case 'et_pb_slider-header_font_size':
[7102] Fix | Delete
$font_size_coefficient = .565217391; // 26/46
[7103] Fix | Delete
break;
[7104] Fix | Delete
[7105] Fix | Delete
case 'et_pb_slider-body_font_size':
[7106] Fix | Delete
$font_size_coefficient = .777777778; // 14/16
[7107] Fix | Delete
break;
[7108] Fix | Delete
[7109] Fix | Delete
default:
[7110] Fix | Delete
$font_size_coefficient = .846153846; // 22/26
[7111] Fix | Delete
break;
[7112] Fix | Delete
}
[7113] Fix | Delete
[7114] Fix | Delete
printf( '%1$s { font-size: %2$spx%3$s; }',
[7115] Fix | Delete
esc_html( $css( '.et_pb_column_1_3 ' . $setting['selector'], false ) ),
[7116] Fix | Delete
esc_html( $value * $font_size_coefficient ),
[7117] Fix | Delete
$important
[7118] Fix | Delete
);
[7119] Fix | Delete
[7120] Fix | Delete
printf( '%1$s { font-size: %2$spx%3$s; }',
[7121] Fix | Delete
esc_html( $css( '.et_pb_column_1_4 ' . $setting['selector'], false ) ),
[7122] Fix | Delete
esc_html( $value * $font_size_coefficient ),
[7123] Fix | Delete
$important
[7124] Fix | Delete
);
[7125] Fix | Delete
}
[7126] Fix | Delete
[7127] Fix | Delete
break;
[7128] Fix | Delete
[7129] Fix | Delete
case 'font-size':
[7130] Fix | Delete
$value = intval( $value );
[7131] Fix | Delete
[7132] Fix | Delete
printf( $css( '.et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value ) );
[7133] Fix | Delete
printf( $css( '.et_pb_column_3_8 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
[7134] Fix | Delete
printf( $css( '.et_pb_column_1_3 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
[7135] Fix | Delete
printf( $css( '.et_pb_column_1_4 .et_pb_countdown_timer .title', false ) . ' { font-size: %spx; }', esc_html( $value * ( 18 / 22 ) ) );
[7136] Fix | Delete
break;
[7137] Fix | Delete
[7138] Fix | Delete
case 'font-style':
[7139] Fix | Delete
printf( "%s { %s }\n", esc_html( $selector ), et_pb_print_font_style( $value, $important ) );
[7140] Fix | Delete
break;
[7141] Fix | Delete
[7142] Fix | Delete
case 'color':
[7143] Fix | Delete
printf( "%s { color: %s%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
[7144] Fix | Delete
break;
[7145] Fix | Delete
[7146] Fix | Delete
case 'background-color':
[7147] Fix | Delete
printf( "%s { background-color: %s%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
[7148] Fix | Delete
break;
[7149] Fix | Delete
[7150] Fix | Delete
case 'border-radius':
[7151] Fix | Delete
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 ) );
[7152] Fix | Delete
break;
[7153] Fix | Delete
[7154] Fix | Delete
case 'width':
[7155] Fix | Delete
printf( "%s { width: %spx%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
[7156] Fix | Delete
break;
[7157] Fix | Delete
[7158] Fix | Delete
case 'height':
[7159] Fix | Delete
printf( "%s { height: %spx%s; }\n", esc_html( $selector ), esc_html( $value ), $important );
[7160] Fix | Delete
break;
[7161] Fix | Delete
[7162] Fix | Delete
case 'padding':
[7163] Fix | Delete
printf( "%s { padding: %spx; }\n", esc_html( $selector ), esc_html( $value ) );
[7164] Fix | Delete
break;
[7165] Fix | Delete
[7166] Fix | Delete
case 'padding-top-bottom':
[7167] Fix | Delete
printf( "%s { padding: %spx 0; }\n", esc_html( $selector ), esc_html( $value ) );
[7168] Fix | Delete
break;
[7169] Fix | Delete
[7170] Fix | Delete
case 'padding-tabs':
[7171] Fix | Delete
$padding_tab_top_bottom = intval( $value ) * 0.133333333;
[7172] Fix | Delete
$padding_tab_active_top = $padding_tab_top_bottom + 1;
[7173] Fix | Delete
$padding_tab_active_bottom = $padding_tab_top_bottom - 1;
[7174] Fix | Delete
$padding_tab_content = intval( $value ) * 0.8;
[7175] Fix | Delete
[7176] Fix | Delete
// negative result will cause layout issue
[7177] Fix | Delete
if ( $padding_tab_active_bottom < 0 ) {
[7178] Fix | Delete
$padding_tab_active_bottom = 0;
[7179] Fix | Delete
}
[7180] Fix | Delete
[7181] Fix | Delete
printf(
[7182] Fix | Delete
"%s { padding: %spx %spx %spx; }\n",
[7183] Fix | Delete
esc_html( $css( '.et_pb_tabs_controls li', false ) ),
[7184] Fix | Delete
esc_html( $padding_tab_active_top ),
[7185] Fix | Delete
esc_html( $value ),
[7186] Fix | Delete
esc_html( $padding_tab_active_bottom )
[7187] Fix | Delete
);
[7188] Fix | Delete
[7189] Fix | Delete
printf(
[7190] Fix | Delete
"%s { padding: %spx %spx; }\n",
[7191] Fix | Delete
esc_html( $css( '.et_pb_tabs_controls li.et_pb_tab_active', false ) ),
[7192] Fix | Delete
esc_html( $padding_tab_top_bottom ),
[7193] Fix | Delete
esc_html( $value )
[7194] Fix | Delete
);
[7195] Fix | Delete
[7196] Fix | Delete
printf(
[7197] Fix | Delete
"%s { padding: %spx %spx; }\n",
[7198] Fix | Delete
esc_html( $css( '.et_pb_all_tabs', false ) ),
[7199] Fix | Delete
esc_html( $padding_tab_content ),
[7200] Fix | Delete
esc_html( $value )
[7201] Fix | Delete
);
[7202] Fix | Delete
break;
[7203] Fix | Delete
[7204] Fix | Delete
case 'padding-slider':
[7205] Fix | Delete
printf( "%s { padding-top: %s; padding-bottom: %s }\n", esc_html( $selector ), esc_html( $value ) . '%', esc_html( $value ) . '%' );
[7206] Fix | Delete
[7207] Fix | Delete
if ( 'et_pagebuilder_slider_padding' === $key ) {
[7208] Fix | Delete
printf( '@media only screen and ( max-width: 767px ) { %1$s { padding-top: %2$s; padding-bottom: %2$s; } }', esc_html( $selector ), '16%' );
[7209] Fix | Delete
}
[7210] Fix | Delete
break;
[7211] Fix | Delete
[7212] Fix | Delete
case 'padding-call-to-action':
[7213] Fix | Delete
$value = intval( $value );
[7214] Fix | Delete
[7215] Fix | Delete
printf(
[7216] Fix | Delete
"%s { padding: %spx %spx !important; }\n",
[7217] Fix | Delete
esc_html( $css( '.et_pb_promo', false ) ),
[7218] Fix | Delete
esc_html( $value ),
[7219] Fix | Delete
esc_html( $value * ( 60 / 40 ) )
[7220] Fix | Delete
);
[7221] Fix | Delete
[7222] Fix | Delete
printf(
[7223] Fix | Delete
"%s { padding: %spx; }\n",
[7224] Fix | Delete
esc_html( $css( '.et_pb_column_1_2 .et_pb_promo', false ) ),
[7225] Fix | Delete
esc_html( $value )
[7226] Fix | Delete
);
[7227] Fix | Delete
[7228] Fix | Delete
printf(
[7229] Fix | Delete
"%s { padding: %spx; }\n",
[7230] Fix | Delete
esc_html( $css( '.et_pb_column_1_3 .et_pb_promo', false ) ),
[7231] Fix | Delete
esc_html( $value )
[7232] Fix | Delete
);
[7233] Fix | Delete
[7234] Fix | Delete
printf(
[7235] Fix | Delete
"%s { padding: %spx; }\n",
[7236] Fix | Delete
esc_html( $css( '.et_pb_column_1_4 .et_pb_promo', false ) ),
[7237] Fix | Delete
esc_html( $value )
[7238] Fix | Delete
);
[7239] Fix | Delete
[7240] Fix | Delete
break;
[7241] Fix | Delete
[7242] Fix | Delete
case 'social-icon-size':
[7243] Fix | Delete
$icon_margin = intval( $value ) * 0.57;
[7244] Fix | Delete
$icon_dimension = intval( $value ) * 2;
[7245] Fix | Delete
?>
[7246] Fix | Delete
<?php echo $css( '.et_pb_social_media_follow li a.icon', false ); ?> {
[7247] Fix | Delete
margin-right: <?php echo esc_html( $icon_margin ); ?>px;
[7248] Fix | Delete
width: <?php echo esc_html( $icon_dimension ); ?>px;
[7249] Fix | Delete
height: <?php echo esc_html( $icon_dimension ); ?>px;
[7250] Fix | Delete
}
[7251] Fix | Delete
[7252] Fix | Delete
<?php echo $css( '.et_pb_social_media_follow li a.icon::before', false ); ?> {
[7253] Fix | Delete
width: <?php echo esc_html( $icon_dimension ); ?>px;
[7254] Fix | Delete
height: <?php echo esc_html( $icon_dimension ); ?>px;
[7255] Fix | Delete
font-size: <?php echo esc_html( $value ); ?>px;
[7256] Fix | Delete
line-height: <?php echo esc_html( $icon_dimension ); ?>px;
[7257] Fix | Delete
}
[7258] Fix | Delete
[7259] Fix | Delete
<?php echo $css( '.et_pb_social_media_follow li a.follow_button', false ); ?> {
[7260] Fix | Delete
font-size: <?php echo esc_html( $value ); ?>px;
[7261] Fix | Delete
}
[7262] Fix | Delete
<?php
[7263] Fix | Delete
break;
[7264] Fix | Delete
[7265] Fix | Delete
case 'border-top-style':
[7266] Fix | Delete
printf( "%s { border-top-style: %s; }\n", esc_html( $selector ), esc_html( $value ) );
[7267] Fix | Delete
break;
[7268] Fix | Delete
[7269] Fix | Delete
case 'border-top-width':
[7270] Fix | Delete
printf( "%s { border-top-width: %spx; }\n", esc_html( $selector ), esc_html( $value ) );
[7271] Fix | Delete
break;
[7272] Fix | Delete
}
[7273] Fix | Delete
}
[7274] Fix | Delete
}
[7275] Fix | Delete
}
[7276] Fix | Delete
}
[7277] Fix | Delete
[7278] Fix | Delete
/**
[7279] Fix | Delete
* Outputting font-style attributes & values saved by ET_Divi_Font_Style_Option on customizer
[7280] Fix | Delete
*
[7281] Fix | Delete
* @return string
[7282] Fix | Delete
*/
[7283] Fix | Delete
function et_pb_print_font_style( $styles = '', $important = '' ) {
[7284] Fix | Delete
[7285] Fix | Delete
// Prepare variable
[7286] Fix | Delete
$font_styles = "";
[7287] Fix | Delete
[7288] Fix | Delete
if ( '' !== $styles && false !== $styles ) {
[7289] Fix | Delete
// Convert string into array
[7290] Fix | Delete
$styles_array = explode( '|', $styles );
[7291] Fix | Delete
[7292] Fix | Delete
// If $important is in use, give it a space
[7293] Fix | Delete
if ( $important && '' !== $important ) {
[7294] Fix | Delete
$important = " " . $important;
[7295] Fix | Delete
}
[7296] Fix | Delete
[7297] Fix | Delete
// Use in_array to find values in strings. Otherwise, display default text
[7298] Fix | Delete
[7299] Fix | Delete
// Font weight
[7300] Fix | Delete
if ( in_array( 'bold', $styles_array ) ) {
[7301] Fix | Delete
$font_styles .= "font-weight: bold{$important}; ";
[7302] Fix | Delete
} else {
[7303] Fix | Delete
$font_styles .= "font-weight: normal{$important}; ";
[7304] Fix | Delete
}
[7305] Fix | Delete
[7306] Fix | Delete
// Font style
[7307] Fix | Delete
if ( in_array( 'italic', $styles_array ) ) {
[7308] Fix | Delete
$font_styles .= "font-style: italic{$important}; ";
[7309] Fix | Delete
} else {
[7310] Fix | Delete
$font_styles .= "font-style: normal{$important}; ";
[7311] Fix | Delete
}
[7312] Fix | Delete
[7313] Fix | Delete
// Text-transform
[7314] Fix | Delete
if ( in_array( 'uppercase', $styles_array ) ) {
[7315] Fix | Delete
$font_styles .= "text-transform: uppercase{$important}; ";
[7316] Fix | Delete
} else {
[7317] Fix | Delete
$font_styles .= "text-transform: none{$important}; ";
[7318] Fix | Delete
}
[7319] Fix | Delete
[7320] Fix | Delete
// Text-decoration
[7321] Fix | Delete
if ( in_array( 'underline', $styles_array ) ) {
[7322] Fix | Delete
$font_styles .= "text-decoration: underline{$important}; ";
[7323] Fix | Delete
} else {
[7324] Fix | Delete
$font_styles .= "text-decoration: none{$important}; ";
[7325] Fix | Delete
}
[7326] Fix | Delete
}
[7327] Fix | Delete
[7328] Fix | Delete
return esc_html( $font_styles );
[7329] Fix | Delete
}
[7330] Fix | Delete
[7331] Fix | Delete
/*
[7332] Fix | Delete
* Adds color scheme class to the body tag
[7333] Fix | Delete
*/
[7334] Fix | Delete
function et_customizer_color_scheme_class( $body_class ) {
[7335] Fix | Delete
$color_scheme = et_get_option( 'color_schemes', 'none' );
[7336] Fix | Delete
$color_scheme_prefix = 'et_color_scheme_';
[7337] Fix | Delete
[7338] Fix | Delete
if ( 'none' !== $color_scheme ) $body_class[] = $color_scheme_prefix . $color_scheme;
[7339] Fix | Delete
[7340] Fix | Delete
return $body_class;
[7341] Fix | Delete
}
[7342] Fix | Delete
add_filter( 'body_class', 'et_customizer_color_scheme_class' );
[7343] Fix | Delete
[7344] Fix | Delete
/*
[7345] Fix | Delete
* Adds button class to the body tag
[7346] Fix | Delete
*/
[7347] Fix | Delete
function et_customizer_button_class( $body_class ) {
[7348] Fix | Delete
$button_icon_placement = et_get_option( 'all_buttons_icon_placement', 'right' );
[7349] Fix | Delete
$button_icon_on_hover = et_get_option( 'all_buttons_icon_hover', 'yes' );
[7350] Fix | Delete
$button_use_icon = et_get_option( 'all_buttons_icon', 'yes' );
[7351] Fix | Delete
$button_icon = et_get_option( 'all_buttons_selected_icon', '5' );
[7352] Fix | Delete
[7353] Fix | Delete
if ( 'left' === $button_icon_placement ) {
[7354] Fix | Delete
$body_class[] = 'et_button_left';
[7355] Fix | Delete
}
[7356] Fix | Delete
[7357] Fix | Delete
if ( 'no' === $button_icon_on_hover ) {
[7358] Fix | Delete
$body_class[] = 'et_button_icon_visible';
[7359] Fix | Delete
}
[7360] Fix | Delete
[7361] Fix | Delete
if ( 'no' === $button_use_icon ) {
[7362] Fix | Delete
$body_class[] = 'et_button_no_icon';
[7363] Fix | Delete
}
[7364] Fix | Delete
[7365] Fix | Delete
if ( '5' !== $button_icon ) {
[7366] Fix | Delete
$body_class[] = 'et_button_custom_icon';
[7367] Fix | Delete
}
[7368] Fix | Delete
[7369] Fix | Delete
$body_class[] = 'et_pb_button_helper_class';
[7370] Fix | Delete
[7371] Fix | Delete
return $body_class;
[7372] Fix | Delete
}
[7373] Fix | Delete
add_filter( 'body_class', 'et_customizer_button_class' );
[7374] Fix | Delete
[7375] Fix | Delete
function et_load_google_fonts_scripts() {
[7376] Fix | Delete
$theme_version = et_get_theme_version();
[7377] Fix | Delete
[7378] Fix | Delete
wp_enqueue_script( 'et_google_fonts', get_template_directory_uri() . '/epanel/google-fonts/et_google_fonts.js', array( 'jquery' ), $theme_version, true );
[7379] Fix | Delete
wp_localize_script( 'et_google_fonts', 'et_google_fonts_data', array(
[7380] Fix | Delete
'user_fonts' => et_builder_get_custom_fonts(),
[7381] Fix | Delete
) );
[7382] Fix | Delete
}
[7383] Fix | Delete
add_action( 'customize_controls_print_footer_scripts', 'et_load_google_fonts_scripts' );
[7384] Fix | Delete
[7385] Fix | Delete
function et_load_google_fonts_styles() {
[7386] Fix | Delete
$theme_version = et_get_theme_version();
[7387] Fix | Delete
[7388] Fix | Delete
wp_enqueue_style( 'et_google_fonts_style', get_template_directory_uri() . '/epanel/google-fonts/et_google_fonts.css', array(), $theme_version );
[7389] Fix | Delete
}
[7390] Fix | Delete
add_action( 'customize_controls_print_styles', 'et_load_google_fonts_styles' );
[7391] Fix | Delete
[7392] Fix | Delete
if ( ! function_exists( 'et_divi_post_meta' ) ) :
[7393] Fix | Delete
function et_divi_post_meta() {
[7394] Fix | Delete
$postinfo = is_single() ? et_get_option( 'divi_postinfo2' ) : et_get_option( 'divi_postinfo1' );
[7395] Fix | Delete
[7396] Fix | Delete
if ( $postinfo ) :
[7397] Fix | Delete
echo '<p class="post-meta">';
[7398] Fix | Delete
echo et_pb_postinfo_meta( $postinfo, et_get_option( 'divi_date_format', 'M j, Y' ), esc_html__( '0 comments', 'Divi' ), esc_html__( '1 comment', 'Divi' ), '% ' . esc_html__( 'comments', 'Divi' ) );
[7399] Fix | Delete
echo '</p>';
[7400] Fix | Delete
endif;
[7401] Fix | Delete
}
[7402] Fix | Delete
endif;
[7403] Fix | Delete
[7404] Fix | Delete
function et_video_embed_html( $video ) {
[7405] Fix | Delete
if ( is_single() && 'video' === et_pb_post_format() ) {
[7406] Fix | Delete
static $post_video_num = 0;
[7407] Fix | Delete
[7408] Fix | Delete
$post_video_num++;
[7409] Fix | Delete
[7410] Fix | Delete
// Hide first video in the post content on single video post page
[7411] Fix | Delete
if ( 1 === $post_video_num ) {
[7412] Fix | Delete
return '';
[7413] Fix | Delete
}
[7414] Fix | Delete
}
[7415] Fix | Delete
[7416] Fix | Delete
return "<div class='et_post_video'>{$video}</div>";
[7417] Fix | Delete
}
[7418] Fix | Delete
[7419] Fix | Delete
function et_do_video_embed_html(){
[7420] Fix | Delete
add_filter( 'embed_oembed_html', 'et_video_embed_html' );
[7421] Fix | Delete
}
[7422] Fix | Delete
add_action( 'et_before_content', 'et_do_video_embed_html' );
[7423] Fix | Delete
[7424] Fix | Delete
/**
[7425] Fix | Delete
* Removes galleries on single gallery posts, since we display images from all
[7426] Fix | Delete
* galleries on top of the page
[7427] Fix | Delete
*/
[7428] Fix | Delete
function et_delete_post_gallery( $content ) {
[7429] Fix | Delete
$deleted = false;
[7430] Fix | Delete
[7431] Fix | Delete
if ( ( is_single() || is_archive() ) && is_main_query() && has_post_format( 'gallery' ) ) :
[7432] Fix | Delete
if ( et_theme_builder_overrides_layout( ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ) ) {
[7433] Fix | Delete
// Do not remove galleries when TB has taken over.
[7434] Fix | Delete
return $content;
[7435] Fix | Delete
}
[7436] Fix | Delete
[7437] Fix | Delete
$regex = get_shortcode_regex();
[7438] Fix | Delete
preg_match_all( "/{$regex}/s", $content, $matches );
[7439] Fix | Delete
[7440] Fix | Delete
// $matches[2] holds an array of shortcodes names in the post
[7441] Fix | Delete
foreach ( $matches[2] as $key => $shortcode_match ) {
[7442] Fix | Delete
if ( 'gallery' === $shortcode_match ) {
[7443] Fix | Delete
$content = str_replace( $matches[0][$key], '', $content );
[7444] Fix | Delete
$deleted = true;
[7445] Fix | Delete
break;
[7446] Fix | Delete
}
[7447] Fix | Delete
}
[7448] Fix | Delete
$content = apply_filters('et_delete_post_gallery', $content, $deleted);
[7449] Fix | Delete
endif;
[7450] Fix | Delete
[7451] Fix | Delete
return $content;
[7452] Fix | Delete
}
[7453] Fix | Delete
add_filter( 'the_content', 'et_delete_post_gallery' );
[7454] Fix | Delete
// Include GB galleries in `get_post_gallery`
[7455] Fix | Delete
add_filter( 'et_gb_gallery_include_in_get_post_gallery', '__return_true' );
[7456] Fix | Delete
[7457] Fix | Delete
function et_divi_post_admin_scripts_styles( $hook ) {
[7458] Fix | Delete
global $typenow;
[7459] Fix | Delete
[7460] Fix | Delete
$theme_version = et_get_theme_version();
[7461] Fix | Delete
$current_screen = get_current_screen();
[7462] Fix | Delete
[7463] Fix | Delete
if ( ! in_array( $hook, array( 'post-new.php', 'post.php' ) ) ) return;
[7464] Fix | Delete
[7465] Fix | Delete
if ( ! isset( $typenow ) ) return;
[7466] Fix | Delete
[7467] Fix | Delete
if ( in_array( $typenow, array( 'post' ) ) ) {
[7468] Fix | Delete
wp_enqueue_style( 'wp-color-picker' );
[7469] Fix | Delete
wp_enqueue_script( 'wp-color-picker' );
[7470] Fix | Delete
wp_enqueue_script( 'et-admin-post-script', get_template_directory_uri() . '/js/admin_post_settings.js', array( 'jquery' ), $theme_version );
[7471] Fix | Delete
}
[7472] Fix | Delete
}
[7473] Fix | Delete
add_action( 'admin_enqueue_scripts', 'et_divi_post_admin_scripts_styles' );
[7474] Fix | Delete
[7475] Fix | Delete
function et_password_form() {
[7476] Fix | Delete
$pwbox_id = rand();
[7477] Fix | Delete
[7478] Fix | Delete
$form_output = sprintf(
[7479] Fix | Delete
'<div class="et_password_protected_form">
[7480] Fix | Delete
<h1>%1$s</h1>
[7481] Fix | Delete
<p>%2$s:</p>
[7482] Fix | Delete
<form action="%3$s" method="post">
[7483] Fix | Delete
<p><label for="%4$s">%5$s: </label><input name="post_password" id="%4$s" type="password" size="20" maxlength="20" /></p>
[7484] Fix | Delete
<p><button type="submit" name="et_divi_submit_button" class="et_submit_button et_pb_button">%6$s</button></p>
[7485] Fix | Delete
</form>
[7486] Fix | Delete
</div>',
[7487] Fix | Delete
esc_html__( 'Password Protected', 'Divi' ),
[7488] Fix | Delete
esc_html__( 'To view this protected post, enter the password below', 'Divi' ),
[7489] Fix | Delete
esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ),
[7490] Fix | Delete
esc_attr( 'pwbox-' . $pwbox_id ),
[7491] Fix | Delete
esc_html__( 'Password', 'Divi' ),
[7492] Fix | Delete
esc_html__( 'Submit', 'Divi' )
[7493] Fix | Delete
);
[7494] Fix | Delete
[7495] Fix | Delete
$output = sprintf(
[7496] Fix | Delete
'<div class="et_pb_section et_section_regular">
[7497] Fix | Delete
<div class="et_pb_row">
[7498] Fix | Delete
<div class="et_pb_column et_pb_column_4_4">
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function