Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi
File: functions.php
%1$s
[7500] Fix | Delete
</div>
[7501] Fix | Delete
</div>
[7502] Fix | Delete
</div>',
[7503] Fix | Delete
$form_output
[7504] Fix | Delete
);
[7505] Fix | Delete
[7506] Fix | Delete
return preg_replace( '/\t+/', '', $output );
[7507] Fix | Delete
}
[7508] Fix | Delete
add_filter( 'the_password_form', 'et_password_form' );
[7509] Fix | Delete
[7510] Fix | Delete
function et_add_wp_version( $classes ) {
[7511] Fix | Delete
global $wp_version;
[7512] Fix | Delete
[7513] Fix | Delete
$is_admin_body_class = 'admin_body_class' === current_filter();
[7514] Fix | Delete
[7515] Fix | Delete
// add 'et-wp-pre-3_8' class if the current WordPress version is less than 3.8
[7516] Fix | Delete
if ( version_compare( $wp_version, '3.7.2', '<=' ) ) {
[7517] Fix | Delete
if ( 'body_class' === current_filter() ) {
[7518] Fix | Delete
$classes[] = 'et-wp-pre-3_8';
[7519] Fix | Delete
} else {
[7520] Fix | Delete
$classes .= ' et-wp-pre-3_8';
[7521] Fix | Delete
}
[7522] Fix | Delete
} else if ( $is_admin_body_class ) {
[7523] Fix | Delete
$classes .= ' et-wp-after-3_8';
[7524] Fix | Delete
}
[7525] Fix | Delete
[7526] Fix | Delete
if ( $is_admin_body_class ) {
[7527] Fix | Delete
$classes = ltrim( $classes );
[7528] Fix | Delete
}
[7529] Fix | Delete
[7530] Fix | Delete
return $classes;
[7531] Fix | Delete
}
[7532] Fix | Delete
add_filter( 'body_class', 'et_add_wp_version' );
[7533] Fix | Delete
add_filter( 'admin_body_class', 'et_add_wp_version' );
[7534] Fix | Delete
[7535] Fix | Delete
/**
[7536] Fix | Delete
* Determine whether current primary nav uses transparent nav or not based on primary nav background
[7537] Fix | Delete
* @return bool
[7538] Fix | Delete
*/
[7539] Fix | Delete
function et_divi_is_transparent_primary_nav() {
[7540] Fix | Delete
return 'rgba' == substr( et_get_option( 'primary_nav_bg', '#ffffff' ), 0, 4 );
[7541] Fix | Delete
}
[7542] Fix | Delete
[7543] Fix | Delete
function et_layout_body_class( $classes ) {
[7544] Fix | Delete
$has_tb_header = in_array( 'et-tb-has-header', $classes );
[7545] Fix | Delete
$has_tb_footer = in_array( 'et-tb-has-footer', $classes );
[7546] Fix | Delete
$is_blank_page_tpl = is_page_template( 'page-template-blank.php' );
[7547] Fix | Delete
[7548] Fix | Delete
do_action( 'et_layout_body_class_before', $classes );
[7549] Fix | Delete
[7550] Fix | Delete
if ( 'on' === get_post_meta( get_the_ID(), '_et_pb_side_nav', true ) && et_pb_is_pagebuilder_used( get_the_ID() ) ) {
[7551] Fix | Delete
$classes[] = 'et_pb_side_nav_page';
[7552] Fix | Delete
}
[7553] Fix | Delete
[7554] Fix | Delete
if ( ! $has_tb_header && ! $is_blank_page_tpl ) {
[7555] Fix | Delete
$vertical_nav = et_get_option( 'vertical_nav', false );
[7556] Fix | Delete
if ( et_divi_is_transparent_primary_nav() && ( false === $vertical_nav || '' === $vertical_nav ) ) {
[7557] Fix | Delete
$classes[] = 'et_transparent_nav';
[7558] Fix | Delete
}
[7559] Fix | Delete
[7560] Fix | Delete
if ( true === et_get_option( 'nav_fullwidth', false ) ) {
[7561] Fix | Delete
if ( true === et_get_option( 'vertical_nav', false ) ) {
[7562] Fix | Delete
$classes[] = 'et_fullwidth_nav_temp';
[7563] Fix | Delete
} else {
[7564] Fix | Delete
$classes[] = 'et_fullwidth_nav';
[7565] Fix | Delete
}
[7566] Fix | Delete
}
[7567] Fix | Delete
[7568] Fix | Delete
if ( true === et_get_option( 'secondary_nav_fullwidth', false ) ) {
[7569] Fix | Delete
$classes[] = 'et_fullwidth_secondary_nav';
[7570] Fix | Delete
}
[7571] Fix | Delete
[7572] Fix | Delete
if ( true === et_get_option( 'vertical_nav', false ) ) {
[7573] Fix | Delete
$classes[] = 'et_vertical_nav';
[7574] Fix | Delete
if ( 'right' === et_get_option( 'vertical_nav_orientation', 'left' ) ) {
[7575] Fix | Delete
$classes[] = 'et_vertical_right';
[7576] Fix | Delete
}
[7577] Fix | Delete
} else if ( 'on' === et_get_option( 'divi_fixed_nav', 'on' ) ) {
[7578] Fix | Delete
$classes[] = 'et_fixed_nav';
[7579] Fix | Delete
} else if ( 'on' !== et_get_option( 'divi_fixed_nav', 'on' ) ) {
[7580] Fix | Delete
$classes[] = 'et_non_fixed_nav';
[7581] Fix | Delete
}
[7582] Fix | Delete
[7583] Fix | Delete
if ( true === et_get_option( 'vertical_nav', false ) && 'on' === et_get_option( 'divi_fixed_nav', 'on' ) ) {
[7584] Fix | Delete
$classes[] = 'et_vertical_fixed';
[7585] Fix | Delete
}
[7586] Fix | Delete
[7587] Fix | Delete
if ( true === et_get_option( 'hide_nav', false ) && ( ! is_singular() || is_singular() && 'no' !== get_post_meta( get_the_ID(), '_et_pb_post_hide_nav', true ) ) ) {
[7588] Fix | Delete
$classes[] = 'et_hide_nav';
[7589] Fix | Delete
} else {
[7590] Fix | Delete
$classes[] = 'et_show_nav';
[7591] Fix | Delete
}
[7592] Fix | Delete
[7593] Fix | Delete
if ( is_singular() && 'on' === get_post_meta( get_the_ID(), '_et_pb_show_title', true ) ) {
[7594] Fix | Delete
$classes[] = 'et_pb_show_title';
[7595] Fix | Delete
}
[7596] Fix | Delete
[7597] Fix | Delete
if ( true === et_get_option( 'hide_primary_logo', false ) ) {
[7598] Fix | Delete
$classes[] = 'et_hide_primary_logo';
[7599] Fix | Delete
}
[7600] Fix | Delete
[7601] Fix | Delete
if ( true === et_get_option( 'hide_fixed_logo', false ) ) {
[7602] Fix | Delete
$classes[] = 'et_hide_fixed_logo';
[7603] Fix | Delete
}
[7604] Fix | Delete
[7605] Fix | Delete
if ( true === et_get_option( 'hide_mobile_logo', false ) ) {
[7606] Fix | Delete
$classes[] = 'et_hide_mobile_logo';
[7607] Fix | Delete
}
[7608] Fix | Delete
[7609] Fix | Delete
$et_secondary_nav_items = et_divi_get_top_nav_items();
[7610] Fix | Delete
[7611] Fix | Delete
if ( $et_secondary_nav_items->top_info_defined && 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) {
[7612] Fix | Delete
$classes[] = 'et_secondary_nav_enabled';
[7613] Fix | Delete
}
[7614] Fix | Delete
[7615] Fix | Delete
if ( $et_secondary_nav_items->two_info_panels && 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) {
[7616] Fix | Delete
$classes[] = 'et_secondary_nav_two_panels';
[7617] Fix | Delete
}
[7618] Fix | Delete
[7619] Fix | Delete
if ( $et_secondary_nav_items->secondary_nav && ! ( $et_secondary_nav_items->contact_info_defined || $et_secondary_nav_items->show_header_social_icons ) && 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) {
[7620] Fix | Delete
$classes[] = 'et_secondary_nav_only_menu';
[7621] Fix | Delete
}
[7622] Fix | Delete
[7623] Fix | Delete
if ( is_singular() && et_builder_enabled_for_post( get_the_ID() ) && 'on' == get_post_meta( get_the_ID(), '_et_pb_post_hide_nav', true ) ) {
[7624] Fix | Delete
$classes[] = 'et_hide_nav';
[7625] Fix | Delete
}
[7626] Fix | Delete
[7627] Fix | Delete
$primary_dropdown_animation = et_get_option( 'primary_nav_dropdown_animation', 'fade' );
[7628] Fix | Delete
$classes[] = esc_attr( "et_primary_nav_dropdown_animation_{$primary_dropdown_animation}" );
[7629] Fix | Delete
[7630] Fix | Delete
$secondary_dropdown_animation = et_get_option( 'secondary_nav_dropdown_animation', 'fade' );
[7631] Fix | Delete
$classes[] = esc_attr( "et_secondary_nav_dropdown_animation_{$secondary_dropdown_animation}" );
[7632] Fix | Delete
[7633] Fix | Delete
$header_style = et_get_option( 'header_style', 'left' );
[7634] Fix | Delete
$classes[] = esc_attr( "et_header_style_{$header_style}" );
[7635] Fix | Delete
[7636] Fix | Delete
if ( 'slide' === $header_style || 'fullscreen' === $header_style ) {
[7637] Fix | Delete
$classes[] = esc_attr( "et_header_style_left" );
[7638] Fix | Delete
if ( 'fullscreen' === $header_style && ! et_get_option( 'slide_nav_show_top_bar', true ) ) {
[7639] Fix | Delete
// additional class if top bar disabled in Fullscreen menu
[7640] Fix | Delete
$classes[] = esc_attr( "et_pb_no_top_bar_fullscreen" );
[7641] Fix | Delete
}
[7642] Fix | Delete
}
[7643] Fix | Delete
[7644] Fix | Delete
$logo = et_get_option( 'divi_logo', '' );
[7645] Fix | Delete
if ( '.svg' === substr( $logo, -4, 4 ) ) {
[7646] Fix | Delete
$classes[] = 'et_pb_svg_logo';
[7647] Fix | Delete
}
[7648] Fix | Delete
}
[7649] Fix | Delete
[7650] Fix | Delete
if ( ! $has_tb_footer && ! $is_blank_page_tpl ) {
[7651] Fix | Delete
$footer_columns = et_get_option( 'footer_columns', '4' );
[7652] Fix | Delete
$classes[] = esc_attr( "et_pb_footer_columns{$footer_columns}" );
[7653] Fix | Delete
}
[7654] Fix | Delete
[7655] Fix | Delete
// home-posts class is used by customizer > blog to work. It modifies post title and meta
[7656] Fix | Delete
// of WP default layout (home, archive, single), but should not modify post title and meta of blog module (page as home)
[7657] Fix | Delete
if ( in_array( 'home', $classes ) && ! in_array( 'page', $classes ) ) {
[7658] Fix | Delete
$classes[] = 'home-posts';
[7659] Fix | Delete
}
[7660] Fix | Delete
[7661] Fix | Delete
if ( true === et_get_option( 'boxed_layout', false ) ) {
[7662] Fix | Delete
$classes[] = 'et_boxed_layout';
[7663] Fix | Delete
}
[7664] Fix | Delete
[7665] Fix | Delete
if ( false !== et_get_option( 'cover_background', true ) ) {
[7666] Fix | Delete
$classes[] = 'et_cover_background';
[7667] Fix | Delete
}
[7668] Fix | Delete
[7669] Fix | Delete
if ( ! et_get_option( 'use_sidebar_width', false ) ) {
[7670] Fix | Delete
$classes[] = 'et_pb_gutter';
[7671] Fix | Delete
}
[7672] Fix | Delete
[7673] Fix | Delete
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
[7674] Fix | Delete
if ( stristr( $_SERVER['HTTP_USER_AGENT'], "mac" ) ) {
[7675] Fix | Delete
$classes[] = 'osx';
[7676] Fix | Delete
} elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], "linux" ) ) {
[7677] Fix | Delete
$classes[] = 'linux';
[7678] Fix | Delete
} elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], "windows" ) ) {
[7679] Fix | Delete
$classes[] = 'windows';
[7680] Fix | Delete
}
[7681] Fix | Delete
}
[7682] Fix | Delete
[7683] Fix | Delete
$page_custom_gutter = get_post_meta( get_the_ID(), '_et_pb_gutter_width', true );
[7684] Fix | Delete
$gutter_width = ! empty( $page_custom_gutter ) && is_singular() ? $page_custom_gutter : (string) et_get_option( 'gutter_width', '3' );
[7685] Fix | Delete
$classes[] = esc_attr( "et_pb_gutters{$gutter_width}" );
[7686] Fix | Delete
[7687] Fix | Delete
// Add the page builder class.
[7688] Fix | Delete
if ( et_pb_is_pagebuilder_used( get_the_ID() ) && ! ET_GB_Block_Layout::is_layout_block_preview() ) {
[7689] Fix | Delete
$classes[] = 'et_pb_pagebuilder_layout';
[7690] Fix | Delete
}
[7691] Fix | Delete
[7692] Fix | Delete
// Add smooth scroll class name
[7693] Fix | Delete
if ( 'on' === et_get_option( 'divi_smooth_scroll', false ) ) {
[7694] Fix | Delete
$classes[] = 'et_smooth_scroll';
[7695] Fix | Delete
}
[7696] Fix | Delete
[7697] Fix | Delete
do_action( 'et_layout_body_class_after', $classes );
[7698] Fix | Delete
[7699] Fix | Delete
return $classes;
[7700] Fix | Delete
}
[7701] Fix | Delete
add_filter( 'body_class', 'et_layout_body_class' );
[7702] Fix | Delete
[7703] Fix | Delete
if ( ! function_exists( 'et_layout_post_class' ) ):
[7704] Fix | Delete
function et_layout_post_class( $classes ) {
[7705] Fix | Delete
global $template;
[7706] Fix | Delete
[7707] Fix | Delete
$post_id = get_the_ID();
[7708] Fix | Delete
$post_type = get_post_type( $post_id );
[7709] Fix | Delete
$template_name = basename( $template );
[7710] Fix | Delete
[7711] Fix | Delete
if ( 'page' === $post_type ) {
[7712] Fix | Delete
// Don't add the class to pages.
[7713] Fix | Delete
return $classes;
[7714] Fix | Delete
}
[7715] Fix | Delete
[7716] Fix | Delete
if ( in_array( $template_name, array( 'index.php', 'single.php' ) ) ) {
[7717] Fix | Delete
// The class has already been added by one of the theme's templates.
[7718] Fix | Delete
return $classes;
[7719] Fix | Delete
}
[7720] Fix | Delete
[7721] Fix | Delete
// Since the theme's templates are not being used, we don't add the class on CPT archive pages.
[7722] Fix | Delete
if ( is_single() && et_pb_is_pagebuilder_used( $post_id ) ) {
[7723] Fix | Delete
$classes[] = 'et_pb_post';
[7724] Fix | Delete
}
[7725] Fix | Delete
[7726] Fix | Delete
return $classes;
[7727] Fix | Delete
}
[7728] Fix | Delete
add_filter( 'post_class', 'et_layout_post_class' );
[7729] Fix | Delete
endif;
[7730] Fix | Delete
[7731] Fix | Delete
if ( ! function_exists( 'et_show_cart_total' ) ) {
[7732] Fix | Delete
function et_show_cart_total( $args = array() ) {
[7733] Fix | Delete
if ( ! class_exists( 'woocommerce' ) || ! WC()->cart ) {
[7734] Fix | Delete
return;
[7735] Fix | Delete
}
[7736] Fix | Delete
[7737] Fix | Delete
$defaults = array(
[7738] Fix | Delete
'no_text' => false,
[7739] Fix | Delete
);
[7740] Fix | Delete
[7741] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[7742] Fix | Delete
[7743] Fix | Delete
$items_number = WC()->cart->get_cart_contents_count();
[7744] Fix | Delete
[7745] Fix | Delete
$url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url();
[7746] Fix | Delete
[7747] Fix | Delete
printf(
[7748] Fix | Delete
'<a href="%1$s" class="et-cart-info">
[7749] Fix | Delete
<span>%2$s</span>
[7750] Fix | Delete
</a>',
[7751] Fix | Delete
esc_url( $url ),
[7752] Fix | Delete
( ! $args['no_text']
[7753] Fix | Delete
? esc_html( sprintf(
[7754] Fix | Delete
_nx( '%1$s Item', '%1$s Items', $items_number, 'WooCommerce items number', 'Divi' ),
[7755] Fix | Delete
number_format_i18n( $items_number )
[7756] Fix | Delete
) )
[7757] Fix | Delete
: ''
[7758] Fix | Delete
)
[7759] Fix | Delete
);
[7760] Fix | Delete
}
[7761] Fix | Delete
}
[7762] Fix | Delete
[7763] Fix | Delete
if ( ! function_exists( 'et_divi_get_top_nav_items' ) ) {
[7764] Fix | Delete
function et_divi_get_top_nav_items() {
[7765] Fix | Delete
$items = new stdClass;
[7766] Fix | Delete
[7767] Fix | Delete
$items->phone_number = trim( et_get_option( 'phone_number' ) );
[7768] Fix | Delete
[7769] Fix | Delete
$items->email = trim( et_get_option( 'header_email' ) );
[7770] Fix | Delete
[7771] Fix | Delete
$items->contact_info_defined = $items->phone_number || $items->email;
[7772] Fix | Delete
[7773] Fix | Delete
$items->show_header_social_icons = et_get_option( 'show_header_social_icons', false );
[7774] Fix | Delete
[7775] Fix | Delete
$items->secondary_nav = wp_nav_menu( array(
[7776] Fix | Delete
'theme_location' => 'secondary-menu',
[7777] Fix | Delete
'container' => '',
[7778] Fix | Delete
'fallback_cb' => '',
[7779] Fix | Delete
'menu_id' => 'et-secondary-nav',
[7780] Fix | Delete
'echo' => false,
[7781] Fix | Delete
) );
[7782] Fix | Delete
[7783] Fix | Delete
$items->top_info_defined = $items->contact_info_defined || $items->show_header_social_icons || $items->secondary_nav;
[7784] Fix | Delete
[7785] Fix | Delete
$items->two_info_panels = $items->contact_info_defined && ( $items->show_header_social_icons || $items->secondary_nav );
[7786] Fix | Delete
[7787] Fix | Delete
return $items;
[7788] Fix | Delete
}
[7789] Fix | Delete
}
[7790] Fix | Delete
[7791] Fix | Delete
function et_divi_activate_features(){
[7792] Fix | Delete
define( 'ET_SHORTCODES_VERSION', et_get_theme_version() );
[7793] Fix | Delete
[7794] Fix | Delete
/* activate shortcodes */
[7795] Fix | Delete
require_once( get_template_directory() . '/epanel/shortcodes/shortcodes.php' );
[7796] Fix | Delete
}
[7797] Fix | Delete
add_action( 'init', 'et_divi_activate_features' );
[7798] Fix | Delete
[7799] Fix | Delete
require_once( get_template_directory() . '/et-pagebuilder/et-pagebuilder.php' );
[7800] Fix | Delete
require_once get_template_directory() . '/includes/theme-builder.php';
[7801] Fix | Delete
[7802] Fix | Delete
require_once( get_template_directory() . '/includes/block-editor-integration.php' );
[7803] Fix | Delete
[7804] Fix | Delete
/**
[7805] Fix | Delete
* Custom body classes for sidebar location in different places
[7806] Fix | Delete
* @return array
[7807] Fix | Delete
*/
[7808] Fix | Delete
function et_divi_sidebar_class( $classes ) {
[7809] Fix | Delete
if ( in_array( 'et-tb-has-body', $classes ) ) {
[7810] Fix | Delete
// TB has taken over the body area so there is no sidebar.
[7811] Fix | Delete
return $classes;
[7812] Fix | Delete
}
[7813] Fix | Delete
[7814] Fix | Delete
$page_layout = '';
[7815] Fix | Delete
$is_product = function_exists( 'is_product' ) && is_product();
[7816] Fix | Delete
$default_sidebar_class = $is_product ? et_get_option( 'et_pb_woocommerce_product_layout' ) : et_get_option( 'divi_sidebar' );
[7817] Fix | Delete
$post_id = get_queried_object_id();
[7818] Fix | Delete
$is_builder_active = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true ) || et_core_is_fb_enabled();
[7819] Fix | Delete
$is_blank_page_tpl = is_page_template( 'page-template-blank.php' );
[7820] Fix | Delete
[7821] Fix | Delete
if ( ! $default_sidebar_class ) {
[7822] Fix | Delete
$default_sidebar_class = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
[7823] Fix | Delete
}
[7824] Fix | Delete
[7825] Fix | Delete
// Set Woo shop and taxonomies layout.
[7826] Fix | Delete
if ( class_exists( 'woocommerce' ) && ( is_woocommerce() && ( is_shop() || is_tax() || $is_product ) ) ) {
[7827] Fix | Delete
if ( $is_product ) {
[7828] Fix | Delete
$saved_page_layout = get_post_meta( $post_id, '_et_pb_page_layout', true );
[7829] Fix | Delete
$page_layout = ! $saved_page_layout || ( 'et_full_width_page' === $saved_page_layout && ! $is_builder_active ) ? $default_sidebar_class : $saved_page_layout;
[7830] Fix | Delete
} else {
[7831] Fix | Delete
$page_layout = et_get_option( 'divi_shop_page_sidebar', $default_sidebar_class );
[7832] Fix | Delete
}
[7833] Fix | Delete
} elseif ( ! is_singular() || ( ! ( $page_layout = get_post_meta( $post_id, '_et_pb_page_layout', true ) ) && ! $is_builder_active ) ) { // check for the falsy value not for boolean `false`
[7834] Fix | Delete
// Set post meta layout which will work for all third party plugins.
[7835] Fix | Delete
$page_layout = $default_sidebar_class;
[7836] Fix | Delete
} elseif ( $is_builder_active && ($is_blank_page_tpl || ! $page_layout || is_page() ) ) {
[7837] Fix | Delete
$page_layout = 'et_no_sidebar';
[7838] Fix | Delete
}
[7839] Fix | Delete
[7840] Fix | Delete
// Handle et_no_sidebar class. It should be no_sidebar for all custom post types, or any post type if builder active.
[7841] Fix | Delete
// otherwise apply 'et_full_width_page' class for backward compatibility
[7842] Fix | Delete
if ( 'et_no_sidebar' === $page_layout && is_singular() ) {
[7843] Fix | Delete
if ( et_builder_post_is_of_custom_post_type( $post_id ) || $is_builder_active ) {
[7844] Fix | Delete
$classes[] = 'et_no_sidebar';
[7845] Fix | Delete
} else {
[7846] Fix | Delete
$classes[] = 'et_full_width_page';
[7847] Fix | Delete
}
[7848] Fix | Delete
} else {
[7849] Fix | Delete
// Add the page layout class.
[7850] Fix | Delete
$classes[] = $page_layout;
[7851] Fix | Delete
}
[7852] Fix | Delete
[7853] Fix | Delete
// Maybe add the full width portfolio class.
[7854] Fix | Delete
if ( is_singular( 'project' ) && ( in_array( $page_layout, array( 'et_full_width_page', 'et_no_sidebar' ) ) ) ) {
[7855] Fix | Delete
$classes[] = 'et_full_width_portfolio_page';
[7856] Fix | Delete
}
[7857] Fix | Delete
[7858] Fix | Delete
return $classes;
[7859] Fix | Delete
}
[7860] Fix | Delete
add_filter( 'body_class', 'et_divi_sidebar_class' );
[7861] Fix | Delete
[7862] Fix | Delete
/**
[7863] Fix | Delete
* Custom body classes for handling customizer preview screen
[7864] Fix | Delete
* @return array
[7865] Fix | Delete
*/
[7866] Fix | Delete
function et_divi_customize_preview_class( $classes ) {
[7867] Fix | Delete
if ( is_customize_preview() ) {
[7868] Fix | Delete
// Customizer class name for customizer specific stuff
[7869] Fix | Delete
$classes[] = 'et_is_customize_preview';
[7870] Fix | Delete
[7871] Fix | Delete
// Search icon state
[7872] Fix | Delete
if ( ! et_get_option( 'show_search_icon', true ) ) {
[7873] Fix | Delete
$classes[] = 'et_hide_search_icon';
[7874] Fix | Delete
}
[7875] Fix | Delete
}
[7876] Fix | Delete
[7877] Fix | Delete
return $classes;
[7878] Fix | Delete
}
[7879] Fix | Delete
add_filter( 'body_class', 'et_divi_customize_preview_class' );
[7880] Fix | Delete
[7881] Fix | Delete
function et_modify_shop_page_columns_num( $columns_num ) {
[7882] Fix | Delete
if ( ! et_is_woocommerce_plugin_active() ) {
[7883] Fix | Delete
return $columns_num;
[7884] Fix | Delete
}
[7885] Fix | Delete
[7886] Fix | Delete
// WooCommerce plugin active check ensures that archive function can be used.
[7887] Fix | Delete
$is_archive_page = is_shop() || is_product_category() || is_product_tag();
[7888] Fix | Delete
[7889] Fix | Delete
if ( ! $is_archive_page ) {
[7890] Fix | Delete
return $columns_num;
[7891] Fix | Delete
}
[7892] Fix | Delete
[7893] Fix | Delete
$default_sidebar_class = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
[7894] Fix | Delete
$divi_shop_page_sidebar = et_get_option( 'divi_shop_page_sidebar', $default_sidebar_class );
[7895] Fix | Delete
[7896] Fix | Delete
// Assignment is intentional for readability.
[7897] Fix | Delete
$columns_num = 'et_full_width_page' === $divi_shop_page_sidebar ? 4 : 3;
[7898] Fix | Delete
[7899] Fix | Delete
return $columns_num;
[7900] Fix | Delete
}
[7901] Fix | Delete
add_filter( 'loop_shop_columns', 'et_modify_shop_page_columns_num' );
[7902] Fix | Delete
[7903] Fix | Delete
// WooCommerce
[7904] Fix | Delete
[7905] Fix | Delete
global $pagenow;
[7906] Fix | Delete
if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) {
[7907] Fix | Delete
// Prevent Cache Warning From Being Displayed On First Install
[7908] Fix | Delete
$current_theme_version[ et_get_theme_version() ] = 'ignore' ;
[7909] Fix | Delete
update_option( 'et_pb_cache_notice', $current_theme_version );
[7910] Fix | Delete
[7911] Fix | Delete
add_action( 'init', 'et_divi_woocommerce_image_dimensions', 1 );
[7912] Fix | Delete
}
[7913] Fix | Delete
[7914] Fix | Delete
/**
[7915] Fix | Delete
* Default values for WooCommerce images changed in version 1.3
[7916] Fix | Delete
* Checks if WooCommerce image dimensions have been updated already.
[7917] Fix | Delete
*/
[7918] Fix | Delete
function et_divi_check_woocommerce_images() {
[7919] Fix | Delete
if ( 'checked' === et_get_option( 'divi_1_3_images' ) ) return;
[7920] Fix | Delete
[7921] Fix | Delete
et_divi_woocommerce_image_dimensions();
[7922] Fix | Delete
et_update_option( 'divi_1_3_images', 'checked' );
[7923] Fix | Delete
}
[7924] Fix | Delete
add_action( 'admin_init', 'et_divi_check_woocommerce_images' );
[7925] Fix | Delete
[7926] Fix | Delete
function et_divi_woocommerce_image_dimensions() {
[7927] Fix | Delete
$catalog = array(
[7928] Fix | Delete
'width' => '400',
[7929] Fix | Delete
'height' => '400',
[7930] Fix | Delete
'crop' => 1,
[7931] Fix | Delete
);
[7932] Fix | Delete
[7933] Fix | Delete
$single = array(
[7934] Fix | Delete
'width' => '510',
[7935] Fix | Delete
'height' => '9999',
[7936] Fix | Delete
'crop' => 0,
[7937] Fix | Delete
);
[7938] Fix | Delete
[7939] Fix | Delete
$thumbnail = array(
[7940] Fix | Delete
'width' => '157',
[7941] Fix | Delete
'height' => '157',
[7942] Fix | Delete
'crop' => 1,
[7943] Fix | Delete
);
[7944] Fix | Delete
[7945] Fix | Delete
update_option( 'shop_catalog_image_size', $catalog );
[7946] Fix | Delete
update_option( 'shop_single_image_size', $single );
[7947] Fix | Delete
update_option( 'shop_thumbnail_image_size', $thumbnail );
[7948] Fix | Delete
}
[7949] Fix | Delete
[7950] Fix | Delete
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ):
[7951] Fix | Delete
function woocommerce_template_loop_product_thumbnail() {
[7952] Fix | Delete
printf( '<span class="et_shop_image">%1$s<span class="et_overlay"></span></span>',
[7953] Fix | Delete
woocommerce_get_product_thumbnail()
[7954] Fix | Delete
);
[7955] Fix | Delete
}
[7956] Fix | Delete
endif;
[7957] Fix | Delete
[7958] Fix | Delete
function et_divi_output_product_wrapper() {
[7959] Fix | Delete
echo '<div class="clearfix">';
[7960] Fix | Delete
}
[7961] Fix | Delete
[7962] Fix | Delete
function et_divi_output_product_wrapper_end() {
[7963] Fix | Delete
echo '</div><!-- #end wrapper -->';
[7964] Fix | Delete
}
[7965] Fix | Delete
[7966] Fix | Delete
function et_review_gravatar_size( $size ) {
[7967] Fix | Delete
return '80';
[7968] Fix | Delete
}
[7969] Fix | Delete
add_filter( 'woocommerce_review_gravatar_size', 'et_review_gravatar_size' );
[7970] Fix | Delete
[7971] Fix | Delete
[7972] Fix | Delete
function et_divi_output_content_wrapper() {
[7973] Fix | Delete
echo '
[7974] Fix | Delete
<div id="main-content">
[7975] Fix | Delete
<div class="container">
[7976] Fix | Delete
<div id="content-area" class="clearfix">
[7977] Fix | Delete
<div id="left-area">';
[7978] Fix | Delete
}
[7979] Fix | Delete
[7980] Fix | Delete
function et_divi_output_content_wrapper_end() {
[7981] Fix | Delete
$default_sidebar_class = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
[7982] Fix | Delete
$fullwidth_post = is_singular() && 'et_full_width_page' === get_post_meta( get_the_ID(), '_et_pb_page_layout', true );
[7983] Fix | Delete
[7984] Fix | Delete
echo '</div> <!-- #left-area -->';
[7985] Fix | Delete
[7986] Fix | Delete
if ( function_exists( 'woocommerce_get_sidebar' ) ) {
[7987] Fix | Delete
$woo_fullwidth_page = ( is_shop() || is_product_category() || is_product_tag() || is_tax() ) && 'et_full_width_page' === et_get_option( 'divi_shop_page_sidebar', $default_sidebar_class );
[7988] Fix | Delete
if ( ! $fullwidth_post && ! $woo_fullwidth_page ) {
[7989] Fix | Delete
woocommerce_get_sidebar();
[7990] Fix | Delete
}
[7991] Fix | Delete
} else if ( ! $fullwidth_post ) {
[7992] Fix | Delete
get_sidebar();
[7993] Fix | Delete
}
[7994] Fix | Delete
[7995] Fix | Delete
echo '
[7996] Fix | Delete
</div> <!-- #content-area -->
[7997] Fix | Delete
</div> <!-- .container -->
[7998] Fix | Delete
</div> <!-- #main-content -->';
[7999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function