: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Filter the list of post types the Divi Builder is enabled on based on theme options.
* @param array<string, string> $options
* @return array<string, string>
if ( ! function_exists( 'et_divi_filter_enabled_builder_post_type_options' ) ) :
function et_divi_filter_enabled_builder_post_type_options( $options ) {
// Cache results to avoid unnecessary option fetching multiple times per request.
static $stored_options = null;
if ( null === $stored_options ) {
$stored_options = et_get_option( 'et_pb_post_type_integration', array() );
add_filter( 'et_builder_enabled_builder_post_type_options', 'et_divi_filter_enabled_builder_post_type_options' );
* Caches expensive generation of truncate_post content
if ( ! function_exists( 'et_divi_truncate_post_use_custom_content' ) ) :
function et_divi_truncate_post_use_custom_content( $custom, $content, $post ) {
// If post doesn't use builder, no need to compute a custom value
if ( ! et_pb_is_pagebuilder_used( $post->ID ) ) {
$cached = get_post_meta( $post->ID, '_et_pb_truncate_post', true );
$cached_date = get_post_meta( $post->ID, '_et_pb_truncate_post_date', true );
$cached_date = $cached_date ? $cached_date : get_post_field( 'post_modified', $post->ID );
$global_modules = array();
preg_match_all( '/'. get_shortcode_regex() .'/s', $content, $shortcodes );
if ( is_array( $shortcodes ) && isset( $shortcodes[3] ) ) {
foreach ( $shortcodes[3] as $raw_attributes ) {
$attributes = shortcode_parse_atts( $raw_attributes );
$attributes = is_array( $attributes ) ? $attributes : array();
$global_id = (int) et_()->array_get( $attributes, 'global_module', 0 );
$global_modules[] = $global_id;
foreach ( $global_modules as $module_post_id ) {
// Dates are using the Y-m-d H:i:s format so we can compare them as strings for simplicity.
if ( strcmp( get_post_field( 'post_modified', $module_post_id ), $cached_date ) > 0 ) {
// A global module used in the post has been updated more recently than
// the post's cached excerpt so we need to invalidate the cache.
$custom = apply_filters( 'the_content', $content );
// Save the result because expensive to compute.
update_post_meta( $post->ID, '_et_pb_truncate_post', $custom );
update_post_meta( $post->ID, '_et_pb_truncate_post_date', date( 'Y-m-d H:i:s' ) );
add_filter( 'et_truncate_post_use_custom_content', 'et_divi_truncate_post_use_custom_content', 10, 3 );
* Caches expensive generation of et_first_image
if ( ! function_exists( 'et_divi_first_image_use_custom_content' ) ) :
function et_divi_first_image_use_custom_content( $custom, $content, $post ) {
// If post doesn't use builder, no need to compute a custom value
if ( ! et_pb_is_pagebuilder_used( $post->ID ) ) {
$cached = get_post_meta( $post->ID, '_et_pb_first_image', true );
$custom = apply_filters( 'the_content', $content );
// Save the result because expensive to compute.
update_post_meta( $post->ID, '_et_pb_first_image', $custom );
add_filter( 'et_first_image_use_custom_content', 'et_divi_first_image_use_custom_content', 10, 3 );
* Fired when post is saved in VB / BFB / BB
* @param integer $post_id
if ( ! function_exists( 'et_divi_save_post' ) ) :
function et_divi_save_post( $post_id ) {
update_post_meta( $post_id, '_et_pb_first_image', false );
update_post_meta( $post_id, '_et_pb_truncate_post', false );
update_post_meta( $post_id, '_et_pb_truncate_post_date', '' );
add_action( 'et_save_post', 'et_divi_save_post', 1 );
if ( ! function_exists( 'et_divi_footer_active_sidebars' ) ):
function et_divi_footer_active_sidebars() {
$et_active_sidebar = array( 2, 3, 4, 5, 6, 7 );
if ( ! is_customize_preview() ) {
if ( ! is_active_sidebar( 2 )
&& ! is_active_sidebar( 3 )
&& ! is_active_sidebar( 4 )
&& ! is_active_sidebar( 5 )
&& ! is_active_sidebar( 6 )
&& ! is_active_sidebar( 7 ) ) {
$footer_columns = et_get_option( 'footer_columns', '4' );
switch ( $footer_columns ) {
$et_active_sidebar = array();
for ( $i = 1; $i <= $footer_columns; $i++ ) {
array_push( $et_active_sidebar, ( $i + 1 ) );
$et_active_sidebar = array( 2, 3 );
$et_active_sidebar = array( 2, 3, 4 );
$et_active_sidebar = array( 2, 3, 4, 5 );
return $et_active_sidebar;
* Check if the theme has boxed layout enabled
function et_divi_is_boxed_layout() {
return true === et_get_option( 'boxed_layout', false );
* Get current theme content container width
function et_divi_get_content_width() {
$value = absint( et_get_option( 'content_width', 1080 ) );
return ( 1080 === $value && et_divi_is_boxed_layout() ) ? 1200 : $value;
* Disable Theme Builder header and footer layouts, if any, on the blank page template.
function et_divi_disable_theme_builder_header_footer_on_blank_template( $layouts ) {
if ( ! is_page_template('page-template-blank.php') || empty( $layouts ) ) {
$layouts[ ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE ]['id'] = 0;
$layouts[ ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE ]['enabled'] = false;
$layouts[ ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE ]['override'] = false;
$layouts[ ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE ]['id'] = 0;
$layouts[ ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE ]['enabled'] = false;
$layouts[ ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE ]['override'] = false;
add_filter( 'et_theme_builder_template_layouts', 'et_divi_disable_theme_builder_header_footer_on_blank_template' );