<div class="<?php echo esc_attr( implode( ' ', $container ) ); ?>">
<p class="et_pb_page_settings et_pb_page_layout_settings">
<label for="et_pb_page_layout" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Page Layout', 'Divi' ); ?>: </label>
<select id="et_pb_page_layout" name="et_pb_page_layout">
foreach ( $page_layouts as $layout_value => $layout_name ) {
printf( '<option value="%2$s"%3$s%4$s>%1$s</option>',
esc_html( $layout_name ),
esc_attr( $layout_value ),
selected( $layout_value, $page_layout, false ),
'et_full_width_page' === $layout_value && ! $is_builder_active ? ' style="display: none;"' : ''
<p class="et_pb_page_settings et_pb_side_nav_settings" style="display: none;">
<label for="et_pb_side_nav" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Dot Navigation', 'Divi' ); ?>: </label>
<select id="et_pb_side_nav" name="et_pb_side_nav">
<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
<p class="et_pb_page_settings et_pb_nav_settings">
<label for="et_pb_post_hide_nav" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Hide Nav Before Scroll', 'Divi' ); ?>: </label>
<select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
<option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
<option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
<option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
<?php if ( 'post' === $post->post_type ) : ?>
<p class="et_pb_page_settings et_pb_single_title" style="display: none;">
<label for="et_single_title" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Post Title', 'Divi' ); ?>: </label>
<select id="et_single_title" name="et_single_title">
<option value="on" <?php selected( 'on', $show_title ); ?>><?php esc_html_e( 'Show', 'Divi' ); ?></option>
<option value="off" <?php selected( 'off', $show_title ); ?>><?php esc_html_e( 'Hide', 'Divi' ); ?></option>
<p class="et_divi_quote_settings et_divi_audio_settings et_divi_link_settings et_divi_format_setting et_pb_page_settings">
<label for="et_post_use_bg_color" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Use Background Color', 'Divi' ); ?></label>
<input name="et_post_use_bg_color" type="checkbox" id="et_post_use_bg_color" <?php checked( $post_use_bg_color ); ?> />
<p class="et_post_bg_color_setting et_divi_format_setting et_pb_page_settings">
<input id="et_post_bg_color" name="et_post_bg_color" class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value', 'Divi' ); ?>" value="<?php echo esc_attr( $post_bg_color ); ?>" data-default-color="#ffffff" />
<p class="et_divi_quote_settings et_divi_audio_settings et_divi_link_settings et_divi_format_setting">
<label for="et_post_bg_layout" style="font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Text Color', 'Divi' ); ?>: </label>
<select id="et_post_bg_layout" name="et_post_bg_layout">
foreach ( $layouts as $layout_name => $layout_title )
printf( '<option value="%s"%s>%s</option>',
esc_attr( $layout_name ),
selected( $layout_name, $post_bg_layout, false ),
esc_html( $layout_title )
if ( 'project' === $post->post_type ) : ?>
<p class="et_pb_page_settings et_pb_project_nav" style="display: none;">
<label for="et_project_nav" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Project Navigation', 'Divi' ); ?>: </label>
<select id="et_project_nav" name="et_project_nav">
<option value="off" <?php selected( 'off', $project_nav ); ?>><?php esc_html_e( 'Hide', 'Divi' ); ?></option>
<option value="on" <?php selected( 'on', $project_nav ); ?>><?php esc_html_e( 'Show', 'Divi' ); ?></option>
<?php if ( 'product' === $post->post_type && $is_builder_active ) : ?>
$product_page_layouts = et_builder_wc_get_page_layouts( 'Divi' );
$product_page_layout = get_post_meta( $post_id, '_et_pb_product_page_layout', true );
// Get the default set at Builder level when `$product_page_layout` isn't set at single Product page.
if ( empty( $product_page_layout ) ) {
$product_page_layout = et_get_option( 'et_pb_woocommerce_page_layout' );
<p class="et_pb_product_page_settings et_pb_product_page_layout_settings">
<label for="et_pb_product_page_layout"
style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Product Content', 'Divi' ); ?>
<select id="et_pb_product_page_layout" name="et_pb_product_page_layout">
foreach ( $product_page_layouts as $layout_value => $layout_name ) {
printf( '<option value="%2$s"%3$s>%1$s</option>',
esc_html( $layout_name ),
esc_attr( $layout_value ),
selected( $layout_value, $product_page_layout, false )
function et_divi_post_settings_save_details( $post_id, $post ) {
if ( 'post.php' !== $pagenow || ! $post || ! is_object( $post ) ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
$post_type = get_post_type_object( $post->post_type );
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
if ( ! isset( $_POST['et_settings_nonce'] ) || ! wp_verify_nonce( $_POST['et_settings_nonce'], basename( __FILE__ ) ) ) {
if ( isset( $_POST['et_post_use_bg_color'] ) )
update_post_meta( $post_id, '_et_post_use_bg_color', true );
delete_post_meta( $post_id, '_et_post_use_bg_color' );
if ( isset( $_POST['et_post_bg_color'] ) )
update_post_meta( $post_id, '_et_post_bg_color', sanitize_text_field( $_POST['et_post_bg_color'] ) );
delete_post_meta( $post_id, '_et_post_bg_color' );
if ( isset( $_POST['et_post_bg_layout'] ) )
update_post_meta( $post_id, '_et_post_bg_layout', sanitize_text_field( $_POST['et_post_bg_layout'] ) );
delete_post_meta( $post_id, '_et_post_bg_layout' );
if ( isset( $_POST['et_single_title'] ) )
update_post_meta( $post_id, '_et_pb_show_title', sanitize_text_field( $_POST['et_single_title'] ) );
delete_post_meta( $post_id, '_et_pb_show_title' );
if ( isset( $_POST['et_pb_post_hide_nav'] ) )
update_post_meta( $post_id, '_et_pb_post_hide_nav', sanitize_text_field( $_POST['et_pb_post_hide_nav'] ) );
delete_post_meta( $post_id, '_et_pb_post_hide_nav' );
if ( isset( $_POST['et_project_nav'] ) )
update_post_meta( $post_id, '_et_pb_project_nav', sanitize_text_field( $_POST['et_project_nav'] ) );
delete_post_meta( $post_id, '_et_pb_project_nav' );
if ( isset( $_POST['et_pb_page_layout'] ) ) {
update_post_meta( $post_id, '_et_pb_page_layout', sanitize_text_field( $_POST['et_pb_page_layout'] ) );
delete_post_meta( $post_id, '_et_pb_page_layout' );
if ( isset( $_POST['et_pb_side_nav'] ) ) {
update_post_meta( $post_id, '_et_pb_side_nav', sanitize_text_field( $_POST['et_pb_side_nav'] ) );
delete_post_meta( $post_id, '_et_pb_side_nav' );
if ( isset( $_POST['et_pb_product_page_layout'] ) ) {
update_post_meta( $post_id, '_et_pb_product_page_layout', sanitize_text_field( $_POST['et_pb_product_page_layout'] ) );
delete_post_meta( $post_id, '_et_pb_product_page_layout' );
add_action( 'save_post', 'et_divi_post_settings_save_details', 10, 2 );
if ( ! function_exists( 'et_get_one_font_languages' ) ) :
* Return the list of languages which support one font
function et_get_one_font_languages() {
_deprecated_function( __FUNCTION__, '4.8', null );
$one_font_languages = array(
'language_name' => 'Japanese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
'font_family' => "'Noto Sans Japanese', serif",
'language_name' => 'Korean',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
'font_family' => "'Hanna', serif",
'language_name' => 'Malay',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
'font_family' => "'Noto Sans Malayalam', serif",
'language_name' => 'Chinese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
'font_family' => "'cwTeXFangSong', serif",
return $one_font_languages;
if ( ! function_exists( 'et_get_old_one_font_languages' ) ) :
* Return the list of languages which supported one font previously.
function et_get_old_one_font_languages() {
$old_one_font_languages = array(
'language_name' => 'Hebrew',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/alefhebrew.css',
'font_family' => 'Alef Hebrew',
'language_name' => 'Arabic',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/lateef.css',
'font_family' => 'Lateef',
'language_name' => 'Thai',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansthai.css',
'font_family' => 'Noto Sans Thai',
'language_name' => 'Japanese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
'font_family' => 'Noto Sans Japanese',
'language_name' => 'Korean',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
'font_family' => 'Hanna',
'language_name' => 'Malayalam',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
'font_family' => 'Noto Sans Malayalam',
'language_name' => 'Chinese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
'font_family' => 'cwTeXFangSong',
return $old_one_font_languages;
* Return custom default font-family for the languages which supported one font previously
if ( ! function_exists( 'et_pb_get_specific_default_font' ) ) :
function et_pb_get_specific_default_font( $font_family ) {
// do nothing if font is not default
if ( ! in_array( $font_family, array( 'none', '' ) ) ) {
$site_domain = get_locale();
// array of the languages which were "one font languages" earlier and have specific defaults
$specific_defaults = et_get_old_one_font_languages();
if ( isset( $specific_defaults[ $site_domain ] ) ) {
return $specific_defaults[ $site_domain ]['font_family'];
function et_divi_customize_register( $wp_customize ) {
$wp_major_version = substr( $wp_version, 0, 3 );
$wp_customize->remove_section( 'title_tagline' );
$wp_customize->remove_section( 'background_image' );
$wp_customize->remove_section( 'colors' );
$wp_customize->register_control_type( 'ET_Divi_Customize_Color_Alpha_Control' );
if ( version_compare( $wp_major_version, '4.9', '>=' ) ) {
wp_register_script( 'wp-color-picker-alpha', get_template_directory_uri() . '/includes/builder/scripts/ext/wp-color-picker-alpha.min.js', array( 'jquery', 'wp-color-picker' ) );
wp_localize_script( 'wp-color-picker-alpha', 'et_pb_color_picker_strings', apply_filters( 'et_pb_color_picker_strings_builder', array(
'legacy_pick' => esc_html__( 'Select', 'et_builder' ),
'legacy_current' => esc_html__( 'Current Color', 'et_builder' ),
wp_register_script( 'wp-color-picker-alpha', get_template_directory_uri() . '/includes/builder/scripts/ext/wp-color-picker-alpha-48.min.js', array( 'jquery', 'wp-color-picker' ) );
$option_set_name = 'et_customizer_option_set';
$option_set_allowed_values = apply_filters( 'et_customizer_option_set_allowed_values', array( 'module', 'theme' ) );
$customizer_option_set = '';
* if 'et_customizer_option_set' query parameter is set to one of the allowed values
if ( isset( $_GET[ $option_set_name ] ) && in_array( $_GET[ $option_set_name ], $option_set_allowed_values ) ) {
$customizer_option_set = $_GET[ $option_set_name ];
set_transient( 'et_divi_customizer_option_set', $customizer_option_set, DAY_IN_SECONDS );
if ( '' === $customizer_option_set && ( $et_customizer_option_set_value = get_transient( 'et_divi_customizer_option_set' ) ) ) {
$customizer_option_set = $et_customizer_option_set_value;
et_builder_init_global_settings();
// Determine if current request is Design Preview Link. Design Preview Link was added on
// WordPress 4.9 and enables user to share customizer change without the need to publish the
// customizer change first: save customizer change as draft, copy the link, and share it with
// collaborator. Design Preview Link works on non-logged in user
// @see https://codex.wordpress.org/Version_4.9
$is_customizer_public_shared_link = ! is_admin() && is_customize_preview() && ! $wp_customize->get_messenger_channel();
// display wp error screen if theme customizer disabled for current user
if ( ! et_pb_is_allowed( 'theme_customizer' ) && ! $is_customizer_public_shared_link ) {
wp_die( esc_html__( "you don't have sufficient permissions to access this page", 'Divi' ) );
et_divi_customizer_theme_settings( $wp_customize );
add_action( 'customize_register', 'et_divi_customize_register' );
if ( ! function_exists( 'et_divi_customizer_theme_settings' ) ) :
* Add our customizer settings.
* @param \WP_Customize_Manager $wp_customize WP_Customize_Manager object.
function et_divi_customizer_theme_settings( $wp_customize ) {
$site_domain = get_locale();
$google_fonts = et_builder_get_fonts(
'prepend_standard_fonts' => false,
$user_fonts = et_builder_get_custom_fonts();
// combine google fonts with custom user fonts.
$google_fonts = array_merge( $user_fonts, $google_fonts );
$et_domain_fonts = array(
'zh_CN' => 'chinese-simplified',
$font_choices['none'] = array(
'label' => 'Default Theme Font',
$removed_fonts_mapping = et_builder_old_fonts_mapping();
foreach ( $google_fonts as $google_font_name => $google_font_properties ) {
$use_parent_font = false;
if ( isset( $removed_fonts_mapping[ $google_font_name ] ) ) {
$parent_font = $removed_fonts_mapping[ $google_font_name ]['parent_font'];
$google_font_properties['character_set'] = $google_fonts[ $parent_font ]['character_set'];
if ( '' !== $site_domain && isset( $et_domain_fonts[ $site_domain ] ) && isset( $google_font_properties['character_set'] ) && false === strpos( $google_font_properties['character_set'], $et_domain_fonts[ $site_domain ] ) ) {
$font_choices[ $google_font_name ] = array(
'label' => $google_font_name,
'parent_font' => $use_parent_font ? $google_font_properties['parent_font'] : '',
'parent_styles' => $use_parent_font ? $google_fonts[ $parent_font ]['styles'] : $google_font_properties['styles'],
'current_styles' => $use_parent_font && isset( $google_fonts[ $parent_font ]['styles'] ) && isset( $google_font_properties['styles'] ) ? $google_font_properties['styles'] : '',
'parent_subset' => $use_parent_font && isset( $google_fonts[ $parent_font ]['character_set'] ) ? $google_fonts[ $parent_font ]['character_set'] : '',
'standard' => isset( $google_font_properties['standard'] ) && $google_font_properties['standard'] ? 'on' : 'off',
$wp_customize->add_panel(
'et_divi_general_settings',
'title' => esc_html__( 'General Settings', 'Divi' ),
$wp_customize->add_section(
'title' => esc_html__( 'Site Identity', 'Divi' ),
'panel' => 'et_divi_general_settings',
$wp_customize->add_section(
'et_divi_general_layout',
'title' => esc_html__( 'Layout Settings', 'Divi' ),
'panel' => 'et_divi_general_settings',
$wp_customize->add_section(
'et_divi_general_typography',
'title' => esc_html__( 'Typography', 'Divi' ),
'panel' => 'et_divi_general_settings',
$wp_customize->add_panel(
'title' => esc_html__( 'Mobile Styles', 'Divi' ),
$wp_customize->add_section(
'title' => esc_html__( 'Tablet', 'Divi' ),
'panel' => 'et_divi_mobile',
$wp_customize->add_section(
'title' => esc_html__( 'Phone', 'Divi' ),
'panel' => 'et_divi_mobile',
$wp_customize->add_section(
'title' => esc_html__( 'Mobile Menu', 'Divi' ),
'panel' => 'et_divi_mobile',
$wp_customize->add_section(
'et_divi_general_background',
'title' => esc_html__( 'Background', 'Divi' ),
'panel' => 'et_divi_general_settings',