: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( in_array( 'uppercase', $styles_array ) ) {
$font_styles .= "text-transform: uppercase{$important}; ";
$font_styles .= "text-transform: none{$important}; ";
if ( in_array( 'underline', $styles_array ) ) {
$font_styles .= "text-decoration: underline{$important}; ";
$font_styles .= "text-decoration: none{$important}; ";
return esc_html( $font_styles );
* Adds color scheme class to the body tag
function et_customizer_color_scheme_class( $body_class ) {
$color_scheme = et_get_option( 'color_schemes', 'none' );
$color_scheme_prefix = 'et_color_scheme_';
if ( 'none' !== $color_scheme ) $body_class[] = $color_scheme_prefix . $color_scheme;
add_filter( 'body_class', 'et_customizer_color_scheme_class' );
* Adds button class to the body tag
function et_customizer_button_class( $body_class ) {
$button_icon_placement = et_get_option( 'all_buttons_icon_placement', 'right' );
$button_icon_on_hover = et_get_option( 'all_buttons_icon_hover', 'yes' );
$button_use_icon = et_get_option( 'all_buttons_icon', 'yes' );
$button_icon = et_get_option( 'all_buttons_selected_icon', '5' );
if ( 'left' === $button_icon_placement ) {
$body_class[] = 'et_button_left';
if ( 'no' === $button_icon_on_hover ) {
$body_class[] = 'et_button_icon_visible';
if ( 'no' === $button_use_icon ) {
$body_class[] = 'et_button_no_icon';
if ( '5' !== $button_icon ) {
$body_class[] = 'et_button_custom_icon';
$body_class[] = 'et_pb_button_helper_class';
add_filter( 'body_class', 'et_customizer_button_class' );
function et_load_google_fonts_scripts() {
$theme_version = et_get_theme_version();
wp_enqueue_script( 'et_google_fonts', get_template_directory_uri() . '/epanel/google-fonts/et_google_fonts.js', array( 'jquery' ), $theme_version, true );
wp_localize_script( 'et_google_fonts', 'et_google_fonts_data', array(
'user_fonts' => et_builder_get_custom_fonts(),
add_action( 'customize_controls_print_footer_scripts', 'et_load_google_fonts_scripts' );
function et_load_google_fonts_styles() {
$theme_version = et_get_theme_version();
wp_enqueue_style( 'et_google_fonts_style', get_template_directory_uri() . '/epanel/google-fonts/et_google_fonts.css', array(), $theme_version );
add_action( 'customize_controls_print_styles', 'et_load_google_fonts_styles' );
if ( ! function_exists( 'et_divi_post_meta' ) ) :
function et_divi_post_meta() {
$postinfo = is_single() ? et_get_option( 'divi_postinfo2' ) : et_get_option( 'divi_postinfo1' );
echo '<p class="post-meta">';
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' ) );
function et_video_embed_html( $video ) {
if ( is_single() && 'video' === et_pb_post_format() ) {
static $post_video_num = 0;
// Hide first video in the post content on single video post page
if ( 1 === $post_video_num ) {
return "<div class='et_post_video'>{$video}</div>";
function et_do_video_embed_html(){
add_filter( 'embed_oembed_html', 'et_video_embed_html' );
add_action( 'et_before_content', 'et_do_video_embed_html' );
* Removes galleries on single gallery posts, since we display images from all
* galleries on top of the page
function et_delete_post_gallery( $content ) {
if ( ( is_single() || is_archive() ) && is_main_query() && has_post_format( 'gallery' ) ) :
if ( et_theme_builder_overrides_layout( ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ) ) {
// Do not remove galleries when TB has taken over.
$regex = get_shortcode_regex();
preg_match_all( "/{$regex}/s", $content, $matches );
// $matches[2] holds an array of shortcodes names in the post
foreach ( $matches[2] as $key => $shortcode_match ) {
if ( 'gallery' === $shortcode_match ) {
$content = str_replace( $matches[0][$key], '', $content );
$content = apply_filters('et_delete_post_gallery', $content, $deleted);
add_filter( 'the_content', 'et_delete_post_gallery' );
// Include GB galleries in `get_post_gallery`
add_filter( 'et_gb_gallery_include_in_get_post_gallery', '__return_true' );
function et_divi_post_admin_scripts_styles( $hook ) {
$theme_version = et_get_theme_version();
$current_screen = get_current_screen();
if ( ! in_array( $hook, array( 'post-new.php', 'post.php' ) ) ) return;
if ( ! isset( $typenow ) ) return;
if ( in_array( $typenow, array( 'post' ) ) ) {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_script( 'et-admin-post-script', get_template_directory_uri() . '/js/admin_post_settings.js', array( 'jquery' ), $theme_version );
add_action( 'admin_enqueue_scripts', 'et_divi_post_admin_scripts_styles' );
function et_password_form() {
'<div class="et_password_protected_form">
<form action="%3$s" method="post">
<p><label for="%4$s">%5$s: </label><input name="post_password" id="%4$s" type="password" size="20" maxlength="20" /></p>
<p><button type="submit" name="et_divi_submit_button" class="et_submit_button et_pb_button">%6$s</button></p>
esc_html__( 'Password Protected', 'Divi' ),
esc_html__( 'To view this protected post, enter the password below', 'Divi' ),
esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ),
esc_attr( 'pwbox-' . $pwbox_id ),
esc_html__( 'Password', 'Divi' ),
esc_html__( 'Submit', 'Divi' )
'<div class="et_pb_section et_section_regular">
<div class="et_pb_column et_pb_column_4_4">
add_filter( 'the_password_form', 'et_password_form' );
function et_add_wp_version( $classes ) {
$is_admin_body_class = 'admin_body_class' === current_filter();
// add 'et-wp-pre-3_8' class if the current WordPress version is less than 3.8
if ( version_compare( $wp_version, '3.7.2', '<=' ) ) {
if ( 'body_class' === current_filter() ) {
$classes[] = 'et-wp-pre-3_8';
$classes .= ' et-wp-pre-3_8';
} else if ( $is_admin_body_class ) {
$classes .= ' et-wp-after-3_8';
if ( $is_admin_body_class ) {
$classes = ltrim( $classes );
add_filter( 'body_class', 'et_add_wp_version' );
add_filter( 'admin_body_class', 'et_add_wp_version' );
* Determine whether current primary nav uses transparent nav or not based on primary nav background
function et_divi_is_transparent_primary_nav() {
return 'rgba' == substr( et_get_option( 'primary_nav_bg', '#ffffff' ), 0, 4 );
function et_layout_body_class( $classes ) {
$has_tb_header = in_array( 'et-tb-has-header', $classes );
$has_tb_footer = in_array( 'et-tb-has-footer', $classes );
$is_blank_page_tpl = is_page_template( 'page-template-blank.php' );
do_action( 'et_layout_body_class_before', $classes );
if ( 'on' === get_post_meta( get_the_ID(), '_et_pb_side_nav', true ) && et_pb_is_pagebuilder_used( get_the_ID() ) ) {
$classes[] = 'et_pb_side_nav_page';
if ( ! $has_tb_header && ! $is_blank_page_tpl ) {
$vertical_nav = et_get_option( 'vertical_nav', false );
if ( et_divi_is_transparent_primary_nav() && ( false === $vertical_nav || '' === $vertical_nav ) ) {
$classes[] = 'et_transparent_nav';
if ( true === et_get_option( 'nav_fullwidth', false ) ) {
if ( true === et_get_option( 'vertical_nav', false ) ) {
$classes[] = 'et_fullwidth_nav_temp';
$classes[] = 'et_fullwidth_nav';
if ( true === et_get_option( 'secondary_nav_fullwidth', false ) ) {
$classes[] = 'et_fullwidth_secondary_nav';
if ( true === et_get_option( 'vertical_nav', false ) ) {
$classes[] = 'et_vertical_nav';
if ( 'right' === et_get_option( 'vertical_nav_orientation', 'left' ) ) {
$classes[] = 'et_vertical_right';
} else if ( 'on' === et_get_option( 'divi_fixed_nav', 'on' ) ) {
$classes[] = 'et_fixed_nav';
} else if ( 'on' !== et_get_option( 'divi_fixed_nav', 'on' ) ) {
$classes[] = 'et_non_fixed_nav';
if ( true === et_get_option( 'vertical_nav', false ) && 'on' === et_get_option( 'divi_fixed_nav', 'on' ) ) {
$classes[] = 'et_vertical_fixed';
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 ) ) ) {
$classes[] = 'et_hide_nav';
$classes[] = 'et_show_nav';
if ( true === et_get_option( 'hide_primary_logo', false ) ) {
$classes[] = 'et_hide_primary_logo';
if ( true === et_get_option( 'hide_fixed_logo', false ) ) {
$classes[] = 'et_hide_fixed_logo';
if ( true === et_get_option( 'hide_mobile_logo', false ) ) {
$classes[] = 'et_hide_mobile_logo';
$et_secondary_nav_items = et_divi_get_top_nav_items();
if ( $et_secondary_nav_items->top_info_defined && 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) {
$classes[] = 'et_secondary_nav_enabled';
if ( $et_secondary_nav_items->two_info_panels && 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) {
$classes[] = 'et_secondary_nav_two_panels';
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' ) ) {
$classes[] = 'et_secondary_nav_only_menu';
if ( is_singular() && et_builder_enabled_for_post( get_the_ID() ) && 'on' == get_post_meta( get_the_ID(), '_et_pb_post_hide_nav', true ) ) {
$classes[] = 'et_hide_nav';
$primary_dropdown_animation = et_get_option( 'primary_nav_dropdown_animation', 'fade' );
$classes[] = esc_attr( "et_primary_nav_dropdown_animation_{$primary_dropdown_animation}" );
$secondary_dropdown_animation = et_get_option( 'secondary_nav_dropdown_animation', 'fade' );
$classes[] = esc_attr( "et_secondary_nav_dropdown_animation_{$secondary_dropdown_animation}" );
$header_style = et_get_option( 'header_style', 'left' );
$classes[] = esc_attr( "et_header_style_{$header_style}" );
if ( 'slide' === $header_style || 'fullscreen' === $header_style ) {
$classes[] = esc_attr( "et_header_style_left" );
if ( 'fullscreen' === $header_style && ! et_get_option( 'slide_nav_show_top_bar', true ) ) {
// additional class if top bar disabled in Fullscreen menu
$classes[] = esc_attr( "et_pb_no_top_bar_fullscreen" );
$logo = et_get_option( 'divi_logo', '' );
if ( '.svg' === substr( $logo, -4, 4 ) ) {
$classes[] = 'et_pb_svg_logo';
if ( ! $has_tb_footer && ! $is_blank_page_tpl ) {
$footer_columns = et_get_option( 'footer_columns', '4' );
$classes[] = esc_attr( "et_pb_footer_columns{$footer_columns}" );
// home-posts class is used by customizer > blog to work. It modifies post title and meta
// of WP default layout (home, archive, single), but should not modify post title and meta of blog module (page as home)
if ( in_array( 'home', $classes ) && ! in_array( 'page', $classes ) ) {
$classes[] = 'home-posts';
if ( true === et_get_option( 'boxed_layout', false ) ) {
$classes[] = 'et_boxed_layout';
if ( false !== et_get_option( 'cover_background', true ) ) {
$classes[] = 'et_cover_background';
if ( ! et_get_option( 'use_sidebar_width', false ) ) {
$classes[] = 'et_pb_gutter';
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
if ( stristr( $_SERVER['HTTP_USER_AGENT'], "mac" ) ) {
} elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], "linux" ) ) {
} elseif ( stristr( $_SERVER['HTTP_USER_AGENT'], "windows" ) ) {
$page_custom_gutter = get_post_meta( get_the_ID(), '_et_pb_gutter_width', true );
$gutter_width = ! empty( $page_custom_gutter ) && is_singular() ? $page_custom_gutter : (string) et_get_option( 'gutter_width', '3' );
$classes[] = esc_attr( "et_pb_gutters{$gutter_width}" );
// Add the page builder class.
if ( et_pb_is_pagebuilder_used( get_the_ID() ) && ! ET_GB_Block_Layout::is_layout_block_preview() ) {
$classes[] = 'et_pb_pagebuilder_layout';
// Add smooth scroll class name
if ( 'on' === et_get_option( 'divi_smooth_scroll', false ) ) {
$classes[] = 'et_smooth_scroll';
do_action( 'et_layout_body_class_after', $classes );
add_filter( 'body_class', 'et_layout_body_class' );
if ( ! function_exists( 'et_layout_post_class' ) ):
function et_layout_post_class( $classes ) {
$post_type = get_post_type( $post_id );
$template_name = basename( $template );
if ( 'page' === $post_type ) {
// Don't add the class to pages.
if ( in_array( $template_name, array( 'index.php', 'single.php' ) ) ) {
// The class has already been added by one of the theme's templates.
// Since the theme's templates are not being used, we don't add the class on CPT archive pages.
if ( is_single() && et_pb_is_pagebuilder_used( $post_id ) ) {
$classes[] = 'et_pb_post';
add_filter( 'post_class', 'et_layout_post_class' );
if ( ! function_exists( 'et_show_cart_total' ) ) {
function et_show_cart_total( $args = array() ) {
if ( ! class_exists( 'woocommerce' ) || ! WC()->cart ) {
$args = wp_parse_args( $args, $defaults );
$items_number = WC()->cart->get_cart_contents_count();
$url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url();
'<a href="%1$s" class="et-cart-info">
_nx( '%1$s Item', '%1$s Items', $items_number, 'WooCommerce items number', 'Divi' ),
number_format_i18n( $items_number )
if ( ! function_exists( 'et_divi_get_top_nav_items' ) ) {
function et_divi_get_top_nav_items() {
$items->phone_number = trim( et_get_option( 'phone_number' ) );
$items->email = trim( et_get_option( 'header_email' ) );
$items->contact_info_defined = $items->phone_number || $items->email;
$items->show_header_social_icons = et_get_option( 'show_header_social_icons', false );
$items->secondary_nav = wp_nav_menu( array(
'theme_location' => 'secondary-menu',
'menu_id' => 'et-secondary-nav',
$items->top_info_defined = $items->contact_info_defined || $items->show_header_social_icons || $items->secondary_nav;
$items->two_info_panels = $items->contact_info_defined && ( $items->show_header_social_icons || $items->secondary_nav );
function et_divi_activate_features(){
define( 'ET_SHORTCODES_VERSION', et_get_theme_version() );
/* activate shortcodes */
require_once( get_template_directory() . '/epanel/shortcodes/shortcodes.php' );
add_action( 'init', 'et_divi_activate_features' );
require_once( get_template_directory() . '/et-pagebuilder/et-pagebuilder.php' );
require_once get_template_directory() . '/includes/theme-builder.php';
require_once( get_template_directory() . '/includes/block-editor-integration.php' );
* Custom body classes for sidebar location in different places
function et_divi_sidebar_class( $classes ) {
if ( in_array( 'et-tb-has-body', $classes ) ) {
// TB has taken over the body area so there is no sidebar.