Repo for divi theme so that it can be used with composer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

8814 lines
294 KiB

<?php
if ( ! isset( $content_width ) ) $content_width = 1080;
function et_setup_theme() {
global $themename, $shortname, $et_store_options_in_one_row, $default_colorscheme;
$themename = 'Divi';
$shortname = 'divi';
$et_store_options_in_one_row = true;
$default_colorscheme = "Default";
$template_directory = get_template_directory();
require_once $template_directory . '/core/init.php';
et_core_setup( get_template_directory_uri() );
if ( '3.0.61' === ET_CORE_VERSION ) {
require_once $template_directory . '/core/functions.php';
require_once $template_directory . '/core/components/init.php';
et_core_patch_core_3061();
}
require_once $template_directory . '/epanel/custom_functions.php';
require_once $template_directory . '/includes/functions/choices.php';
require_once $template_directory . '/includes/functions/dynamic-assets.php';
require_once $template_directory . '/includes/functions/sanitization.php';
require_once $template_directory . '/includes/functions/sidebars.php';
load_theme_textdomain( 'Divi', $template_directory . '/lang' );
require_once $template_directory . '/epanel/core_functions.php';
require_once $template_directory . '/post_thumbnails_divi.php';
include_once $template_directory . '/includes/widgets.php';
register_nav_menus( array(
'primary-menu' => esc_html__( 'Primary Menu', 'Divi' ),
'secondary-menu' => esc_html__( 'Secondary Menu', 'Divi' ),
'footer-menu' => esc_html__( 'Footer Menu', 'Divi' ),
) );
// don't display the empty title bar if the widget title is not set
remove_filter( 'widget_title', 'et_widget_force_title' );
remove_filter( 'body_class', 'et_add_fullwidth_body_class' );
// Declare theme supports
add_theme_support( 'title-tag' );
add_theme_support( 'post-formats', array(
'video', 'audio', 'quote', 'gallery', 'link'
) );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'customize-selective-refresh-widgets' );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_action( 'woocommerce_before_main_content', 'et_divi_output_content_wrapper', 10 );
add_action( 'eventon_before_main_content', 'et_divi_output_content_wrapper', 11 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
add_action( 'woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10 );
add_action( 'eventon_after_main_content', 'et_divi_output_content_wrapper_end', 9 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// add wrapper so we can clear things
add_action( 'woocommerce_before_single_product_summary', 'et_divi_output_product_wrapper', 0 );
add_action( 'woocommerce_after_single_product_summary', 'et_divi_output_product_wrapper_end', 0 );
// deactivate page templates and custom import functions
remove_action( 'init', 'et_activate_features' );
remove_action('admin_menu', 'et_add_epanel');
// Load editor styling
add_editor_style( 'css/editor-style.css' );
add_editor_style( 'css/editor-blocks.css' );
et_divi_version_rollback()->enable();
if ( wp_doing_cron() ) {
et_register_updates_component();
}
// Remove WordPress emojis
add_action( 'init', 'et_disable_emojis' );
// Defer Gutenberg block stylesheet to the footer.
add_action( 'wp_enqueue_scripts', 'et_dequeue_block_css', 100 );
add_action( 'get_footer', 'et_enqueue_block_css', 100 );
}
add_action( 'after_setup_theme', 'et_setup_theme' );
add_action( 'et_do_legacy_shortcode', 'et_add_legacy_shortcode_css' );
add_action( 'et_do_legacy_shortcode', 'et_add_legacy_shortcode_js' );
/**
* Load un-minified and un-combined scripts.
*
* @param string $load check if loading unminified scripts.
* @return string
* @deprecated ??
*/
function et_divi_load_unminified_scripts( $load ) {
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
return true;
}
if ( 'false' === et_get_option( 'divi_minify_combine_scripts' ) ) {
return true;
}
return $load;
}
/**
* Load un-minified and un-combined styles.
*
* @param string $load check if loading unminified styles.
* @return string
* @deprecated ??
*/
function et_divi_load_unminified_styles( $load ) {
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
return true;
}
if ( 'false' === et_get_option( 'divi_minify_combine_styles' ) ) {
return true;
}
return $load;
}
function et_theme_epanel_reminder(){
global $shortname, $themename;
$documentation_url = 'http://www.elegantthemes.com/gallery/divi/readme.html';
$documentation_option_name = $shortname . '_2_4_documentation_message';
if ( false === et_get_option( $shortname . '_logo' ) && false === et_get_option( $documentation_option_name ) ) {
$message = sprintf(
et_get_safe_localization( __( 'Welcome to Divi! Before diving in to your new theme, please visit the <a style="color: #fff; font-weight: bold;" href="%1$s" target="_blank">Divi Documentation</a> page for access to dozens of in-depth tutorials.', $themename ) ),
esc_url( $documentation_url )
);
printf(
'<div class="notice is-dismissible" style="background-color: #6C2EB9; color: #fff; border-left: none;">
<p>%1$s</p>
</div>',
$message
);
et_update_option( $documentation_option_name, 'triggered' );
}
}
add_action( 'admin_notices', 'et_theme_epanel_reminder' );
if ( ! function_exists( 'et_divi_fonts_url' ) ) :
/**
* Print Google fonts style for Divi Theme base fonts.
*/
function et_divi_fonts_url() {
if ( ! et_core_use_google_fonts() ) {
return '';
}
$fonts_url = '';
/**
* Translators: If there are characters in your language that are not
* supported by Open Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$open_sans = _x( 'on', 'Open Sans font: on or off', 'Divi' );
if ( 'off' !== $open_sans ) {
$font_families = array();
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800';
}
$fonts = et_builder_get_fonts();
$full_character_set = ! empty( $fonts['Open Sans'] ) && ! empty( $fonts['Open Sans']['character_set'] ) ? $fonts['Open Sans']['character_set'] : 'cyrillic,cyrillic-ext,greek,greek-ext,latin,latin-ext,vietnamese';
// By default, only latin and latin-ext subsets are loaded, all available subsets can be enabled in ePanel.
$subset = 'false' === et_get_option( 'divi_gf_enable_all_character_sets', 'false' )
? 'latin,latin-ext'
: $full_character_set;
$query_args = array(
'family' => implode( '%7C', $font_families ),
'subset' => $subset,
'display' => 'swap',
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
function et_divi_load_fonts() {
$google_fonts_url = et_divi_fonts_url();
// Get user selected font defined on customizer
$et_gf_body_font = sanitize_text_field( et_get_option( 'body_font', 'none' ) );
$is_et_fb_enabled = function_exists( 'et_fb_enabled' ) && et_fb_enabled();
// Determine whether current page needs Open Sans or not
$no_open_sans = ! is_customize_preview() && 'none' !== $et_gf_body_font && '' !== $et_gf_body_font && ! $is_et_fb_enabled;
if ( ! empty( $google_fonts_url ) && ! $no_open_sans ) {
$feature_manager = ET_Builder_Google_Fonts_Feature::instance();
$output_inline = $feature_manager->is_option_enabled( 'google_fonts_inline' );
if ( $output_inline ) {
$contents = $feature_manager->get(
'google-fonts',
function() use ( $feature_manager, $google_fonts_url ) {
return $feature_manager->fetch( $google_fonts_url );
},
sanitize_text_field( et_core_esc_previously( $google_fonts_url ) )
);
// if something went wrong fetching the contents
if ( false === $contents ) {
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters -- Google fonts api does not have versions
wp_enqueue_style( 'et-divi-open-sans', et_core_esc_previously( $google_fonts_url ), array(), null );
} else {
echo '<style id="et-divi-open-sans-inline-css">' . $contents . '</style>';
}
} else {
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters -- Google fonts api does not have versions.
wp_enqueue_style( 'et-divi-open-sans', et_core_esc_previously( $google_fonts_url ), array(), null );
}
}
}
add_action( 'wp_enqueue_scripts', 'et_divi_load_fonts' );
function et_add_home_link( $args ) {
// add Home link to the custom menu WP-Admin page
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'et_add_home_link' );
function et_divi_load_scripts_styles(){
global $wp_styles, $et_user_fonts_queue;
// $dynamic_js_suffix = et_use_dynamic_js() ? '' : '-static'; // @temp-disabled-dynamic-assets-js
$template_dir = get_template_directory_uri();
$theme_version = et_get_theme_version();
$post_id = get_the_id();
$is_page_builder_used = et_pb_is_pagebuilder_used( $post_id );
$page_comments_disabled = et_get_option( 'divi_show_pagescomments', 'off' );
$post_with_comments = is_single() && comments_open() && get_option( 'thread_comments' );
$page_width_comments = is_page() && ! $is_page_builder_used && comments_open() && get_option( 'thread_comments' ) && $page_comments_disabled === 'on';
if ( $post_with_comments || $page_width_comments ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && has_post_format( 'audio' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
$dependencies_array = array( 'jquery' );
// load 'jquery-effects-core' if SlideIn/Fullscreen header used or if customizer opened
if ( is_customize_preview() || 'slide' === et_get_option( 'header_style', 'left' ) || 'fullscreen' === et_get_option( 'header_style', 'left' ) ) {
$dependencies_array[] = 'jquery-effects-core';
}
wp_enqueue_script( 'divi-custom-script', $template_dir . '/js/scripts.min.js', $dependencies_array, $theme_version, true );
$divi_data = array(
'item_count' => esc_html__( '%d Item', 'divi' ),
'items_count' => esc_html__( '%d Items', 'divi' ),
);
if ( et_core_is_fb_enabled() ) {
$divi_data['row_selector'] = et_divi_get_row_advanced_options_selector_replacement();
}
wp_localize_script( 'divi-custom-script', 'DIVI', $divi_data );
$et_gf_enqueue_fonts = array();
$et_gf_heading_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'heading_font', 'none' ) ) );
$et_gf_body_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'body_font', 'none' ) ) );
$et_gf_button_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'all_buttons_font', 'none' ) ) );
$et_gf_primary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'primary_nav_font', 'none' ) ) );
$et_gf_secondary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'secondary_nav_font', 'none' ) ) );
$et_gf_slide_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'slide_nav_font', 'none' ) ) );
if ( 'none' != $et_gf_heading_font ) $et_gf_enqueue_fonts[] = $et_gf_heading_font;
if ( 'none' != $et_gf_body_font ) $et_gf_enqueue_fonts[] = $et_gf_body_font;
if ( 'none' != $et_gf_button_font ) $et_gf_enqueue_fonts[] = $et_gf_button_font;
if ( 'none' != $et_gf_primary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
if ( 'none' != $et_gf_secondary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
if ( 'none' != $et_gf_slide_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_slide_nav_font;
if ( ! empty( $et_gf_enqueue_fonts ) && function_exists( 'et_builder_enqueue_font' ) ) {
$site_domain = get_locale();
$et_old_one_font_languages = et_get_old_one_font_languages();
foreach ( $et_gf_enqueue_fonts as $single_font ) {
if ( isset( $et_old_one_font_languages[$site_domain] ) ) {
$font_custom_default_data = $et_old_one_font_languages[$site_domain];
// enqueue custom default font if needed
if ( $single_font === $font_custom_default_data['font_family'] ) {
$et_gf_font_name_slug = strtolower( str_replace( ' ', '-', $font_custom_default_data['language_name'] ) );
wp_enqueue_style( 'et-gf-' . $et_gf_font_name_slug, $font_custom_default_data['google_font_url'], array(), null );
continue;
}
}
et_builder_enqueue_font( $single_font );
}
if ( function_exists( 'et_builder_enqueue_user_fonts' ) && ! empty( $et_user_fonts_queue ) ) {
printf( '<style id="et-divi-userfonts">%1$s</style>', et_core_esc_previously( et_builder_enqueue_user_fonts( $et_user_fonts_queue ) ) );
}
}
}
add_action( 'wp_enqueue_scripts', 'et_divi_load_scripts_styles' );
/**
* Enqueue the main style.css file.
* If a child theme is active and the child theme has not enqueued
* the Divi stylsheet, enqueue it for them. Otherwise -rtl, -cpt and -static
* stylesheet versions will never be enqueued properly. Some child themes
* import the Divi style.css file in their child theme .css file, which won't work.
*/
function et_divi_enqueue_stylesheet() {
$theme_version = et_get_theme_version();
$template_directory_uri = preg_quote( get_template_directory_uri(), '/' );
$styles = wp_styles();
$divi_style_enqueued = '';
foreach ( $styles->registered as $handle => $style ) {
if ( preg_match( '/' . $template_directory_uri . '.*/', $style->src ) ) {
$divi_style_enqueued = true;
break;
}
}
if ( ! is_child_theme() ) {
// If no child theme is active, we enqueue the Divi style.css located in the template dir.
wp_enqueue_style( 'divi-style', get_template_directory_uri() . '/style.css', array(), $theme_version );
} elseif ( $divi_style_enqueued ) {
// If a child theme is used and the child theme already enqueued the Divi style.css in their functions.php,
// then we enqueue the child theme style.css file via the stylesheet dir.
wp_enqueue_style( 'divi-style', get_stylesheet_directory_uri() . '/style.css', array(), $theme_version );
} else {
// If a child theme is used and they do not enqueue the Divi style.css file,
// we need to enqueue it for them before their child theme style.css file.
wp_enqueue_style( 'divi-style-parent', get_template_directory_uri() . '/style.css', array(), $theme_version );
wp_enqueue_style( 'divi-style', get_stylesheet_directory_uri() . '/style.css', array(), $theme_version );
}
}
add_action( 'wp_enqueue_scripts', 'et_divi_enqueue_stylesheet' );
/**
* Replace the enqueued Divi style.css file with the applicable version.
* If Dynamic CSS is disabled, we load the -static file. If RTL is enabled, we load the -rtl file.
* If on a custom post type, we load the -cpt file. This is also necessary for child themes,
* which typically enqueue the standard style.css without the logic below.
*/
function et_divi_replace_parent_stylesheet() {
$theme_version = et_get_theme_version();
$post_id = get_the_ID();
$cpt_suffix = et_builder_should_wrap_styles() ? '-cpt' : '';
$dynamic_css_suffix = et_use_dynamic_css() ? '' : '-static';
$rtl_suffix = is_rtl() ? '-rtl' : '';
$template_directory_uri = preg_quote( get_template_directory_uri(), '/' );
$style_handle = is_child_theme() ? 'divi-style-parent' : 'divi-style';
// We check for .dev in case child themes enqueued this legacy stylesheet.
$theme_style = '/^(' . $template_directory_uri . '\/style)(\.dev)?(\.min)?(\.css)$/';
$theme_style_replaced = '$1' . $dynamic_css_suffix . $cpt_suffix . $rtl_suffix . '.min.css';
et_core_replace_enqueued_style( $theme_style, $theme_style_replaced, $theme_version, $style_handle, '', true );
}
add_action( 'wp_enqueue_scripts', 'et_divi_replace_parent_stylesheet', 99999998 );
/**
* If Load Dynamic Stylesheet In-line is enabled in the Divi Theme Options,
* we print stylesheet contents in-line. We must grab the correct base stylesheet
* depending on RTl and CPT.
*/
function et_divi_print_stylesheet() {
$enable_inline_stylesheet = et_get_option( 'divi_inline_stylesheet', 'on' );
if ( 'on' === $enable_inline_stylesheet && et_use_dynamic_css() ) {
$post_id = get_the_ID();
$cpt_suffix = et_builder_should_wrap_styles() ? '-cpt' : '';
$rtl_suffix = is_rtl() ? '-rtl' : '';
$stylesheet_src = get_template_directory_uri() . '/style' . $cpt_suffix . $rtl_suffix . '.min.css';
$stylesheet_path = get_template_directory() . '/style' . $cpt_suffix . $rtl_suffix . '.min.css';
$stylesheet_path = str_replace( '..', '', $stylesheet_path );
$stylesheet_contents = file_get_contents( $stylesheet_path );
$theme_version = et_get_theme_version();
$url_match = '/url\(/i';
$url_replace = 'url(' . get_template_directory_uri() . '/';
$stylesheet_contents_replaced = preg_replace( $url_match, $url_replace, $stylesheet_contents );
$child_theme_suffix = is_child_theme() ? '-parent' : '';
$styles = wp_styles();
foreach ( $styles->registered as $handle => $style ) {
if ( $style->src === $stylesheet_src ) {
$existing_inline_styles = $styles->get_data( $handle, 'after' );
break;
}
}
if ( false !== $stylesheet_contents ) {
wp_register_style( 'divi-style' . $child_theme_suffix . '-inline', false, array(), $theme_version );
wp_enqueue_style( 'divi-style' . $child_theme_suffix . '-inline' );
wp_add_inline_style( 'divi-style' . $child_theme_suffix . '-inline', $stylesheet_contents_replaced );
if ( ! empty( $existing_inline_styles ) ) {
wp_add_inline_style( 'divi-style' . $child_theme_suffix . '-inline', implode( "\n", $existing_inline_styles ) );
}
add_action( 'wp_enqueue_scripts', 'et_divi_dequeue_stylesheet', 99999999 );
}
}
}
add_action( 'wp_enqueue_scripts', 'et_divi_print_stylesheet', 99999998 );
/**
* If Load Dynamic Stylesheet In-line is enabled, we need to dequeue the Divi stylesheet,
* since it's now being enqueued in-line.
*/
function et_divi_dequeue_stylesheet() {
$post_id = get_the_ID();
$cpt_suffix = et_builder_should_wrap_styles() ? '-cpt' : '';
$rtl_suffix = is_rtl() ? '-rtl' : '';
$styles = wp_styles();
$stylesheet = get_template_directory_uri() . '/style' . $cpt_suffix . $rtl_suffix . '.min.css';
if ( empty( $styles->registered ) ) {
return;
}
foreach ( $styles->registered as $handle => $style ) {
if ( $style->src === $stylesheet ) {
wp_dequeue_style( $handle );
break;
}
}
}
/**
* All Child Theme .css files must be dequeued and re-queued so that we can control their order.
* They must be queued below the parent stylesheet, which we have dequeued and re-queued in et_divi_replace_parent_stylesheet().
*/
add_action( 'wp_enqueue_scripts', 'et_requeue_child_theme_styles', 99999999 );
/**
* Enqueue smoothscroll if it's enabled.
*/
function et_enqueue_smoothscroll() {
$theme_version = et_get_theme_version();
if ( 'on' === et_get_option( 'divi_smooth_scroll', 'off' ) ) {
wp_enqueue_script( 'smoothscroll', get_template_directory_uri() . '/js/smoothscroll.js', array(), $theme_version, true );
}
}
add_action( 'wp_enqueue_scripts', 'et_enqueue_smoothscroll' );
/**
* Enqueue magnific popup when needed.
*
* @since ??
*/
function et_enqueue_magnific_popup() {
$theme_version = et_get_theme_version();
if ( 'on' === et_get_option( 'divi_gallery_layout_enable', 'off' ) && ( is_active_widget( false, false, 'media_gallery', true ) || et_is_active_block_widget( 'core/gallery' ) ) ) {
wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/includes/builder/feature/dynamic-assets/assets/js/magnific-popup.js', array( 'jquery' ), $theme_version, true );
}
}
add_action( 'wp_enqueue_scripts', 'et_enqueue_magnific_popup' );
function et_add_mobile_navigation(){
if ( is_customize_preview() || ( 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) ) {
printf(
'<div id="et_mobile_nav_menu">
<div class="mobile_nav closed">
<span class="select_page">%1$s</span>
<span class="mobile_menu_bar mobile_menu_bar_toggle"></span>
</div>
</div>',
esc_html__( 'Select Page', 'Divi' )
);
}
}
add_action( 'et_header_top', 'et_add_mobile_navigation' );
function et_add_viewport_meta(){
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />';
}
add_action( 'wp_head', 'et_add_viewport_meta' );
function et_remove_additional_stylesheet( $stylesheet ){
global $default_colorscheme;
return $default_colorscheme;
}
add_filter( 'et_get_additional_color_scheme', 'et_remove_additional_stylesheet' );
if ( ! function_exists( 'et_list_pings' ) ) :
function et_list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
<?php }
endif;
if ( ! function_exists( 'et_get_theme_version' ) ) :
function et_get_theme_version() {
$theme_info = wp_get_theme();
if ( is_child_theme() ) {
$theme_info = wp_get_theme( $theme_info->parent_theme );
}
$theme_version = $theme_info->display( 'Version' );
return $theme_version;
}
endif;
function et_add_post_meta_box( $post_type, $post ) {
$allowed = et_pb_is_allowed( 'page_options' );
$enabled = $post ? et_builder_enabled_for_post( $post->ID ) : et_builder_enabled_for_post_type( $post_type );
$enabled = in_array( $post_type, et_builder_get_default_post_types() ) ? true : $enabled;
$public = et_builder_is_post_type_public( $post_type );
if ( $allowed && $enabled && $public ) {
add_meta_box( 'et_settings_meta_box', esc_html__( 'Divi Page Settings', 'Divi' ), 'et_single_settings_meta_box', $post_type, 'side', 'high' );
}
}
add_action( 'add_meta_boxes', 'et_add_post_meta_box', 10, 2 );
if ( ! function_exists( 'et_pb_portfolio_meta_box' ) ) :
function et_pb_portfolio_meta_box() { ?>
<div class="et_project_meta">
<strong class="et_project_meta_title"><?php echo esc_html__( 'Skills', 'Divi' ); ?></strong>
<p><?php echo get_the_term_list( get_the_ID(), 'project_tag', '', ', ' ); ?></p>
<strong class="et_project_meta_title"><?php echo esc_html__( 'Posted on', 'Divi' ); ?></strong>
<p><?php echo get_the_date(); ?></p>
</div>
<?php }
endif;
if ( ! function_exists( 'et_single_settings_meta_box' ) ) :
function et_single_settings_meta_box( $post ) {
$post_id = get_the_ID();
wp_nonce_field( basename( __FILE__ ), 'et_settings_nonce' );
$page_layout = get_post_meta( $post_id, '_et_pb_page_layout', true );
if ( 'product' === $post->post_type && empty( $page_layout ) ) {
$page_layout = et_get_option( 'et_pb_woocommerce_product_layout' );
}
$side_nav = get_post_meta( $post_id, '_et_pb_side_nav', true );
$project_nav = get_post_meta( $post_id, '_et_pb_project_nav', true );
$post_hide_nav = get_post_meta( $post_id, '_et_pb_post_hide_nav', true );
$post_hide_nav = $post_hide_nav && 'off' === $post_hide_nav ? 'default' : $post_hide_nav;
$show_title = get_post_meta( $post_id, '_et_pb_show_title', true );
$is_builder_active = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true );
if ( is_rtl() ) {
$page_layouts = array(
'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
);
} else {
$page_layouts = array(
'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
);
}
// Fullwidth option available for default post types only. Not available for custom post types.
if ( ! et_builder_is_post_type_custom( $post->post_type ) || 'product' === $post->post_type && $is_builder_active ) {
$page_layouts['et_full_width_page'] = esc_html__( 'Fullwidth', 'Divi' );
}
if ( 'et_full_width_page' === $page_layout && ( ! isset( $page_layouts['et_full_width_page'] ) || ! $is_builder_active ) ) {
$page_layout = 'et_no_sidebar';
}
$layouts = array(
'light' => esc_html__( 'Light', 'Divi' ),
'dark' => esc_html__( 'Dark', 'Divi' ),
);
$post_bg_color = ( $bg_color = get_post_meta( $post_id, '_et_post_bg_color', true ) ) && '' !== $bg_color
? $bg_color
: '#ffffff';
$post_use_bg_color = get_post_meta( $post_id, '_et_post_use_bg_color', true )
? true
: false;
$post_bg_layout = ( $layout = get_post_meta( $post_id, '_et_post_bg_layout', true ) ) && '' !== $layout
? $layout
: 'light';
$tb_layouts = et_theme_builder_get_template_layouts( ET_Theme_Builder_Request::from_post( $post_id ) );
$container = array( 'et_pb_page_settings_container' );
if ( ! empty( $tb_layouts ) ) {
$container[] = 'et_pb_page_settings_container--theme-builder';
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE ]['override'] ) {
$container[] = 'et_pb_page_settings_container--tb-has-header';
}
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ]['override'] ) {
$container[] = 'et_pb_page_settings_container--tb-has-body';
}
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE ]['override'] ) {
$container[] = 'et_pb_page_settings_container--tb-has-footer';
}
}
?>
<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">
<?php
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;"' : ''
);
} ?>
</select>
</p>
<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>
</select>
</p>
<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>
</select>
</p>
<?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>
</select>
</p>
<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>
<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>
<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">
<?php
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 )
);
?>
</select>
</p>
<?php endif;
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>
</select>
</p>
<?php endif; ?>
<?php if ( 'product' === $post->post_type && $is_builder_active ) : ?>
<?php
$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' ); ?>
: </label>
<select id="et_pb_product_page_layout" name="et_pb_product_page_layout">
<?php
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 )
);
}
?>
</select>
</p>
<?php endif; ?>
</div>
<?php
}
endif;
function et_divi_post_settings_save_details( $post_id, $post ) {
global $pagenow;
if ( 'post.php' !== $pagenow || ! $post || ! is_object( $post ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
$post_type = get_post_type_object( $post->post_type );
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
return;
}
if ( ! isset( $_POST['et_settings_nonce'] ) || ! wp_verify_nonce( $_POST['et_settings_nonce'], basename( __FILE__ ) ) ) {
return;
}
if ( isset( $_POST['et_post_use_bg_color'] ) )
update_post_meta( $post_id, '_et_post_use_bg_color', true );
else
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'] ) );
else
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'] ) );
else
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'] ) );
else
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'] ) );
else
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'] ) );
else
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'] ) );
} else {
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'] ) );
} else {
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'] ) );
} else {
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
*
* @deprecated 4.8
*
* @return array
*/
function et_get_one_font_languages() {
_deprecated_function( __FUNCTION__, '4.8', null );
$one_font_languages = array(
'ja' => array(
'language_name' => 'Japanese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
'font_family' => "'Noto Sans Japanese', serif",
),
'ko_KR' => array(
'language_name' => 'Korean',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
'font_family' => "'Hanna', serif",
),
'ms_MY' => array(
'language_name' => 'Malay',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
'font_family' => "'Noto Sans Malayalam', serif",
),
'zh_CN' => array(
'language_name' => 'Chinese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
'font_family' => "'cwTeXFangSong', serif",
),
);
return $one_font_languages;
}
endif;
if ( ! function_exists( 'et_get_old_one_font_languages' ) ) :
/**
* Return the list of languages which supported one font previously.
*
* @return array
*/
function et_get_old_one_font_languages() {
$old_one_font_languages = array(
'he_IL' => array(
'language_name' => 'Hebrew',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/alefhebrew.css',
'font_family' => 'Alef Hebrew',
),
'ar' => array(
'language_name' => 'Arabic',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/lateef.css',
'font_family' => 'Lateef',
),
'th' => array(
'language_name' => 'Thai',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansthai.css',
'font_family' => 'Noto Sans Thai',
),
'ja' => array(
'language_name' => 'Japanese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
'font_family' => 'Noto Sans Japanese',
),
'ko_KR' => array(
'language_name' => 'Korean',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
'font_family' => 'Hanna',
),
'ml_IN' => array(
'language_name' => 'Malayalam',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
'font_family' => 'Noto Sans Malayalam',
),
'zh_CN' => array(
'language_name' => 'Chinese',
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
'font_family' => 'cwTeXFangSong',
),
);
return $old_one_font_languages;
}
endif;
/**
* Return custom default font-family for the languages which supported one font previously
* @param string
* @return string
*/
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', '' ) ) ) {
return $font_family;
}
$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'];
}
return $font_family;
}
endif;
function et_divi_customize_register( $wp_customize ) {
global $wp_version;
// Get WP major version
$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' ),
) ) );
} else {
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 = '';
/**
* Set a transient,
* 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(
array(
'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(
'ru_RU' => 'cyrillic',
'uk' => 'cyrillic',
'bg_BG' => 'cyrillic',
'vi' => 'vietnamese',
'el' => 'greek',
'ar' => 'arabic',
'he_IL' => 'hebrew',
'th' => 'thai',
'si_lk' => 'sinhala',
'bn_bd' => 'bengali',
'ta_lk' => 'tamil',
'te' => 'telegu',
'km' => 'khmer',
'kn' => 'kannada',
'ml_in' => 'malayalam',
'ja' => 'japanese',
'ko_KR' => 'korean',
'ml_IN' => 'malayalam',
'zh_CN' => 'chinese-simplified',
);
$font_choices = array();
$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'];
$use_parent_font = true;
}
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 ] ) ) {
continue;
}
$font_choices[ $google_font_name ] = array(
'label' => $google_font_name,
'data' => array(
'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',
array(
'title' => esc_html__( 'General Settings', 'Divi' ),
'priority' => 1,
)
);
$wp_customize->add_section(
'title_tagline',
array(
'title' => esc_html__( 'Site Identity', 'Divi' ),
'panel' => 'et_divi_general_settings',
)
);
$wp_customize->add_section(
'et_divi_general_layout',
array(
'title' => esc_html__( 'Layout Settings', 'Divi' ),
'panel' => 'et_divi_general_settings',
)
);
$wp_customize->add_section(
'et_divi_general_typography',
array(
'title' => esc_html__( 'Typography', 'Divi' ),
'panel' => 'et_divi_general_settings',
)
);
$wp_customize->add_panel(
'et_divi_mobile',
array(
'title' => esc_html__( 'Mobile Styles', 'Divi' ),
'priority' => 6,
)
);
$wp_customize->add_section(
'et_divi_mobile_tablet',
array(
'title' => esc_html__( 'Tablet', 'Divi' ),
'panel' => 'et_divi_mobile',
)
);
$wp_customize->add_section(
'et_divi_mobile_phone',
array(
'title' => esc_html__( 'Phone', 'Divi' ),
'panel' => 'et_divi_mobile',
)
);
$wp_customize->add_section(
'et_divi_mobile_menu',
array(
'title' => esc_html__( 'Mobile Menu', 'Divi' ),
'panel' => 'et_divi_mobile',
)
);
$wp_customize->add_section(
'et_divi_general_background',
array(
'title' => esc_html__( 'Background', 'Divi' ),
'panel' => 'et_divi_general_settings',
)
);
$wp_customize->add_panel(
'et_divi_header_panel',
array(
'title' => esc_html__( 'Header & Navigation', 'Divi' ),
'priority' => 2,
)
);
$wp_customize->add_section(
'et_divi_header_layout',
array(
'title' => esc_html__( 'Header Format', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_section(
'et_divi_header_primary',
array(
'title' => esc_html__( 'Primary Menu Bar', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_section(
'et_divi_header_secondary',
array(
'title' => esc_html__( 'Secondary Menu Bar', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_section(
'et_divi_header_slide',
array(
'title' => esc_html__( 'Slide In & Fullscreen Header Settings', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_section(
'et_divi_header_fixed',
array(
'title' => esc_html__( 'Fixed Navigation Settings', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_section(
'et_divi_header_information',
array(
'title' => esc_html__( 'Header Elements', 'Divi' ),
'panel' => 'et_divi_header_panel',
)
);
$wp_customize->add_panel(
'et_divi_footer_panel',
array(
'title' => esc_html__( 'Footer', 'Divi' ),
'priority' => 3,
)
);
$wp_customize->add_section(
'et_divi_footer_layout',
array(
'title' => esc_html__( 'Layout', 'Divi' ),
'panel' => 'et_divi_footer_panel',
)
);
$wp_customize->add_section(
'et_divi_footer_widgets',
array(
'title' => esc_html__( 'Widgets', 'Divi' ),
'panel' => 'et_divi_footer_panel',
)
);
$wp_customize->add_section(
'et_divi_footer_elements',
array(
'title' => esc_html__( 'Footer Elements', 'Divi' ),
'panel' => 'et_divi_footer_panel',
)
);
$wp_customize->add_section(
'et_divi_footer_menu',
array(
'title' => esc_html__( 'Footer Menu', 'Divi' ),
'panel' => 'et_divi_footer_panel',
)
);
$wp_customize->add_section(
'et_divi_bottom_bar',
array(
'title' => esc_html__( 'Bottom Bar', 'Divi' ),
'panel' => 'et_divi_footer_panel',
)
);
$wp_customize->add_section(
'et_color_schemes',
array(
'title' => esc_html__( 'Color Schemes', 'Divi' ),
'priority' => 7,
'description' => esc_html__( 'Note: Color settings set above should be applied to the Default color scheme.', 'Divi' ),
)
);
$wp_customize->add_panel(
'et_divi_buttons_settings',
array(
'title' => esc_html__( 'Buttons', 'Divi' ),
'priority' => 4,
)
);
$wp_customize->add_section(
'et_divi_buttons',
array(
'title' => esc_html__( 'Buttons Style', 'Divi' ),
'panel' => 'et_divi_buttons_settings',
)
);
$wp_customize->add_section(
'et_divi_buttons_hover',
array(
'title' => esc_html__( 'Buttons Hover Style', 'Divi' ),
'panel' => 'et_divi_buttons_settings',
)
);
$wp_customize->add_panel(
'et_divi_blog_settings',
array(
'title' => esc_html__( 'Blog', 'Divi' ),
'priority' => 5,
)
);
$wp_customize->add_section(
'et_divi_blog_post',
array(
'title' => esc_html__( 'Post', 'Divi' ),
'panel' => 'et_divi_blog_settings',
)
);
$wp_customize->add_setting(
'et_divi[post_meta_font_size]',
array(
'default' => '14',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_meta_font_size]',
array(
'label' => esc_html__( 'Meta Text Size', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => 10,
'max' => 32,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_meta_height]',
array(
'default' => '1',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_float_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_meta_height]',
array(
'label' => esc_html__( 'Meta Line Height', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => .8,
'max' => 3,
'step' => .1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_meta_spacing]',
array(
'default' => '0',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_meta_spacing]',
array(
'label' => esc_html__( 'Meta Letter Spacing', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => -2,
'max' => 10,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_meta_style]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_style',
)
);
$wp_customize->add_control(
new ET_Divi_Font_Style_Option(
$wp_customize,
'et_divi[post_meta_style]',
array(
'label' => esc_html__( 'Meta Font Style', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'font_style',
'choices' => et_divi_font_style_choices(),
)
)
);
$wp_customize->add_setting(
'et_divi[post_header_font_size]',
array(
'default' => '30',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_header_font_size]',
array(
'label' => esc_html__( 'Header Text Size', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => 10,
'max' => 72,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_header_height]',
array(
'default' => '1',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_float_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_header_height]',
array(
'label' => esc_html__( 'Header Line Height', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => 0.8,
'max' => 3,
'step' => 0.1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_header_spacing]',
array(
'default' => '0',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_int_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[post_header_spacing]',
array(
'label' => esc_html__( 'Header Letter Spacing', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'range',
'input_attrs' => array(
'min' => -2,
'max' => 10,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[post_header_style]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_style',
)
);
$wp_customize->add_control(
new ET_Divi_Font_Style_Option(
$wp_customize,
'et_divi[post_header_style]',
array(
'label' => esc_html__( 'Header Font Style', 'Divi' ),
'section' => 'et_divi_blog_post',
'type' => 'font_style',
'choices' => et_divi_font_style_choices(),
)
)
);
$wp_customize->add_setting(
'et_divi[boxed_layout]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[boxed_layout]',
array(
'label' => esc_html__( 'Enable Boxed Layout', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[content_width]',
array(
'default' => '1080',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[content_width]',
array(
'label' => esc_html__( 'Website Content Width', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'range',
'input_attrs' => array(
'min' => 960,
'max' => 1920,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[gutter_width]',
array(
'default' => '3',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[gutter_width]',
array(
'label' => esc_html__( 'Website Gutter Width', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'range',
'input_attrs' => array(
'min' => 1,
'max' => 4,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[use_sidebar_width]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[use_sidebar_width]',
array(
'label' => esc_html__( 'Use Custom Sidebar Width', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[sidebar_width]',
array(
'default' => '21',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[sidebar_width]',
array(
'label' => esc_html__( 'Sidebar Width', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'range',
'input_attrs' => array(
'min' => 19,
'max' => 33,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[section_padding]',
array(
'default' => '4',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[section_padding]',
array(
'label' => esc_html__( 'Section Height', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 10,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[phone_section_height]',
array(
'default' => et_get_option( 'tablet_section_height', '50' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[phone_section_height]',
array(
'label' => esc_html__( 'Section Height', 'Divi' ),
'section' => 'et_divi_mobile_phone',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 150,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[tablet_section_height]',
array(
'default' => '50',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[tablet_section_height]',
array(
'label' => esc_html__( 'Section Height', 'Divi' ),
'section' => 'et_divi_mobile_tablet',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 150,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[row_padding]',
array(
'default' => '2',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[row_padding]',
array(
'label' => esc_html__( 'Row Height', 'Divi' ),
'section' => 'et_divi_general_layout',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 10,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[phone_row_height]',
array(
'default' => et_get_option( 'tablet_row_height', '30' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[phone_row_height]',
array(
'label' => esc_html__( 'Row Height', 'Divi' ),
'section' => 'et_divi_mobile_phone',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 150,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[tablet_row_height]',
array(
'default' => '30',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[tablet_row_height]',
array(
'label' => esc_html__( 'Row Height', 'Divi' ),
'section' => 'et_divi_mobile_tablet',
'type' => 'range',
'input_attrs' => array(
'min' => 0,
'max' => 150,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[cover_background]',
array(
'default' => 'on',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[cover_background]',
array(
'label' => esc_html__( 'Stretch Background Image', 'Divi' ),
'section' => 'et_divi_general_background',
'type' => 'checkbox',
)
);
if ( ! is_null( $wp_customize->get_setting( 'background_color' ) ) ) {
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'background_color',
array(
'label' => esc_html__( 'Background Color', 'Divi' ),
'section' => 'et_divi_general_background',
)
)
);
}
if ( ! is_null( $wp_customize->get_setting( 'background_image' ) ) ) {
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'background_image',
array(
'label' => esc_html__( 'Background Image', 'Divi' ),
'section' => 'et_divi_general_background',
)
)
);
}
// Remove default background_repeat setting and control since native
// background_repeat field has different different settings.
$wp_customize->remove_setting( 'background_repeat' );
$wp_customize->remove_control( 'background_repeat' );
// Re-defined Divi specific background repeat option.
$wp_customize->add_setting(
'background_repeat',
array(
'default' => apply_filters( 'et_divi_background_repeat_default', 'repeat' ),
'sanitize_callback' => 'et_sanitize_background_repeat',
'theme_supports' => 'custom-background',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
'background_repeat',
array(
'label' => esc_html__( 'Background Repeat', 'Divi' ),
'section' => 'et_divi_general_background',
'type' => 'radio',
'choices' => et_divi_background_repeat_choices(),
)
);
$wp_customize->add_control(
'background_position_x',
array(
'label' => esc_html__( 'Background Position', 'Divi' ),
'section' => 'et_divi_general_background',
'type' => 'radio',
'choices' => array(
'left' => esc_html__( 'Left', 'Divi' ),
'center' => esc_html__( 'Center', 'Divi' ),
'right' => esc_html__( 'Right', 'Divi' ),
),
)
);
// Remove default background_attachment setting and control since native
// background_attachment field has different different settings.
$wp_customize->remove_setting( 'background_attachment' );
$wp_customize->remove_control( 'background_attachment' );
$wp_customize->add_setting(
'background_attachment',
array(
'default' => apply_filters( 'et_sanitize_background_attachment_default', 'scroll' ),
'sanitize_callback' => 'et_sanitize_background_attachment',
'theme_supports' => 'custom-background',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
'background_attachment',
array(
'label' => esc_html__( 'Background Position', 'Divi' ),
'section' => 'et_divi_general_background',
'type' => 'radio',
'choices' => et_divi_background_attachment_choices(),
)
);
$wp_customize->add_setting(
'et_divi[body_font_size]',
array(
'default' => '14',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[body_font_size]',
array(
'label' => esc_html__( 'Body Text Size', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'range',
'input_attrs' => array(
'min' => 10,
'max' => 32,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[body_font_height]',
array(
'default' => '1.7',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_float_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[body_font_height]',
array(
'label' => esc_html__( 'Body Line Height', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'range',
'input_attrs' => array(
'min' => 0.8,
'max' => 3,
'step' => 0.1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[phone_body_font_size]',
array(
'default' => et_get_option( 'tablet_body_font_size', '14' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[phone_body_font_size]',
array(
'label' => esc_html__( 'Body Text Size', 'Divi' ),
'section' => 'et_divi_mobile_phone',
'type' => 'range',
'input_attrs' => array(
'min' => 10,
'max' => 32,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[tablet_body_font_size]',
array(
'default' => et_get_option( 'body_font_size', '14' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[tablet_body_font_size]',
array(
'label' => esc_html__( 'Body Text Size', 'Divi' ),
'section' => 'et_divi_mobile_tablet',
'type' => 'range',
'input_attrs' => array(
'min' => 10,
'max' => 32,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[body_header_size]',
array(
'default' => '30',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[body_header_size]',
array(
'label' => esc_html__( 'Header Text Size', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'range',
'input_attrs' => array(
'min' => 22,
'max' => 72,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[body_header_spacing]',
array(
'default' => '0',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_int_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[body_header_spacing]',
array(
'label' => esc_html__( 'Header Letter Spacing', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'range',
'input_attrs' => array(
'min' => -2,
'max' => 10,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[body_header_height]',
array(
'default' => '1',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_float_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[body_header_height]',
array(
'label' => esc_html__( 'Header Line Height', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'range',
'input_attrs' => array(
'min' => 0.8,
'max' => 3,
'step' => 0.1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[body_header_style]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_style',
)
);
$wp_customize->add_control(
new ET_Divi_Font_Style_Option(
$wp_customize,
'et_divi[body_header_style]',
array(
'label' => esc_html__( 'Header Font Style', 'Divi' ),
'section' => 'et_divi_general_typography',
'type' => 'font_style',
'choices' => et_divi_font_style_choices(),
)
)
);
$wp_customize->add_setting(
'et_divi[phone_header_font_size]',
array(
'default' => et_get_option( 'tablet_header_font_size', '30' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[phone_header_font_size]',
array(
'label' => esc_html__( 'Header Text Size', 'Divi' ),
'section' => 'et_divi_mobile_phone',
'type' => 'range',
'input_attrs' => array(
'min' => 22,
'max' => 72,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[tablet_header_font_size]',
array(
'default' => et_get_option( 'body_header_size', '30' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[tablet_header_font_size]',
array(
'label' => esc_html__( 'Header Text Size', 'Divi' ),
'section' => 'et_divi_mobile_tablet',
'type' => 'range',
'input_attrs' => array(
'min' => 22,
'max' => 72,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[heading_font]',
array(
'default' => 'none',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_choices',
)
);
$wp_customize->add_control(
new ET_Divi_Select_Option(
$wp_customize,
'et_divi[heading_font]',
array(
'label' => esc_html__( 'Header Font', 'Divi' ),
'section' => 'et_divi_general_typography',
'settings' => 'et_divi[heading_font]',
'type' => 'select',
'choices' => $font_choices,
)
)
);
$wp_customize->add_setting(
'et_divi[body_font]',
array(
'default' => 'none',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_choices',
)
);
$wp_customize->add_control(
new ET_Divi_Select_Option(
$wp_customize,
'et_divi[body_font]',
array(
'label' => esc_html__( 'Body Font', 'Divi' ),
'section' => 'et_divi_general_typography',
'settings' => 'et_divi[body_font]',
'type' => 'select',
'choices' => $font_choices,
)
)
);
$wp_customize->add_setting(
'et_divi[link_color]',
array(
'default' => et_get_option( 'accent_color', '#2ea3f2' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[link_color]',
array(
'label' => esc_html__( 'Body Link Color', 'Divi' ),
'section' => 'et_divi_general_typography',
'settings' => 'et_divi[link_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[font_color]',
array(
'default' => '#666666',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[font_color]',
array(
'label' => esc_html__( 'Body Text Color', 'Divi' ),
'section' => 'et_divi_general_typography',
'settings' => 'et_divi[font_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[header_color]',
array(
'default' => '#666666',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[header_color]',
array(
'label' => esc_html__( 'Header Text Color', 'Divi' ),
'section' => 'et_divi_general_typography',
'settings' => 'et_divi[header_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[accent_color]',
array(
'default' => '#2ea3f2',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[accent_color]',
array(
'label' => esc_html__( 'Theme Accent Color', 'Divi' ),
'section' => 'et_divi_general_layout',
'settings' => 'et_divi[accent_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[color_schemes]',
array(
'default' => 'none',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_color_scheme',
)
);
$wp_customize->add_control(
'et_divi[color_schemes]',
array(
'label' => esc_html__( 'Color Schemes', 'Divi' ),
'section' => 'et_color_schemes',
'settings' => 'et_divi[color_schemes]',
'type' => 'select',
'choices' => et_divi_color_scheme_choices(),
)
);
$wp_customize->add_setting(
'et_divi[header_style]',
array(
'default' => 'left',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_header_style',
)
);
$wp_customize->add_control(
'et_divi[header_style]',
array(
'label' => esc_html__( 'Header Style', 'Divi' ),
'section' => 'et_divi_header_layout',
'type' => 'select',
'choices' => et_divi_header_style_choices(),
)
);
$wp_customize->add_setting(
'et_divi[vertical_nav]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[vertical_nav]',
array(
'label' => esc_html__( 'Enable Vertical Navigation', 'Divi' ),
'section' => 'et_divi_header_layout',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[vertical_nav_orientation]',
array(
'default' => 'left',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_left_right',
)
);
$wp_customize->add_control(
'et_divi[vertical_nav_orientation]',
array(
'label' => esc_html__( 'Vertical Menu Orientation', 'Divi' ),
'section' => 'et_divi_header_layout',
'type' => 'select',
'choices' => et_divi_left_right_choices(),
)
);
if ( 'on' === et_get_option( 'divi_fixed_nav', 'on' ) ) {
$wp_customize->add_setting(
'et_divi[hide_nav]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[hide_nav]',
array(
'label' => esc_html__( 'Hide Navigation Until Scroll', 'Divi' ),
'section' => 'et_divi_header_layout',
'type' => 'checkbox',
)
);
}
$wp_customize->add_setting(
'et_divi[show_header_social_icons]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[show_header_social_icons]',
array(
'label' => esc_html__( 'Show Social Icons', 'Divi' ),
'section' => 'et_divi_header_information',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[show_search_icon]',
array(
'default' => 'on',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[show_search_icon]',
array(
'label' => esc_html__( 'Show Search Icon', 'Divi' ),
'section' => 'et_divi_header_information',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_show_top_bar]',
array(
'default' => 'on',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[slide_nav_show_top_bar]',
array(
'label' => esc_html__( 'Show Top Bar', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_width]',
array(
'default' => '320',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[slide_nav_width]',
array(
'label' => esc_html__( 'Menu Width', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => 280,
'max' => 600,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_font_size]',
array(
'default' => '14',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[slide_nav_font_size]',
array(
'label' => esc_html__( 'Menu Text Size', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => 12,
'max' => 24,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_top_font_size]',
array(
'default' => '14',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[slide_nav_top_font_size]',
array(
'label' => esc_html__( 'Top Bar Text Size', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => 12,
'max' => 24,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[fullscreen_nav_font_size]',
array(
'default' => '30',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[fullscreen_nav_font_size]',
array(
'label' => esc_html__( 'Menu Text Size', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => 12,
'max' => 50,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[fullscreen_nav_top_font_size]',
array(
'default' => '18',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[fullscreen_nav_top_font_size]',
array(
'label' => esc_html__( 'Top Bar Text Size', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => 12,
'max' => 40,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_font_spacing]',
array(
'default' => '0',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_int_number',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[slide_nav_font_spacing]',
array(
'label' => esc_html__( 'Letter Spacing', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'range',
'input_attrs' => array(
'min' => -1,
'max' => 8,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_font]',
array(
'default' => 'none',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_choices',
)
);
$wp_customize->add_control(
new ET_Divi_Select_Option(
$wp_customize,
'et_divi[slide_nav_font]',
array(
'label' => esc_html__( 'Font', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_font]',
'type' => 'select',
'choices' => $font_choices,
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_font_style]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_font_style',
)
);
$wp_customize->add_control(
new ET_Divi_Font_Style_Option(
$wp_customize,
'et_divi[slide_nav_font_style]',
array(
'label' => esc_html__( 'Font Style', 'Divi' ),
'section' => 'et_divi_header_slide',
'type' => 'font_style',
'choices' => et_divi_font_style_choices(),
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_bg]',
array(
'default' => et_get_option( 'accent_color', '#2ea3f2' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_bg]',
array(
'label' => esc_html__( 'Background Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_bg]',
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_links_color]',
array(
'default' => '#ffffff',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_links_color]',
array(
'label' => esc_html__( 'Menu Link Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_links_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_links_color_active]',
array(
'default' => '#ffffff',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_links_color_active]',
array(
'label' => esc_html__( 'Active Link Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_links_color_active]',
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_top_color]',
array(
'default' => 'rgba(255,255,255,0.6)',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_top_color]',
array(
'label' => esc_html__( 'Top Bar Text Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_top_color]',
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_search]',
array(
'default' => 'rgba(255,255,255,0.6)',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_search]',
array(
'label' => esc_html__( 'Search Bar Text Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_search]',
)
)
);
$wp_customize->add_setting(
'et_divi[slide_nav_search_bg]',
array(
'default' => 'rgba(0,0,0,0.2)',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'et_sanitize_alpha_color',
)
);
$wp_customize->add_control(
new ET_Divi_Customize_Color_Alpha_Control(
$wp_customize,
'et_divi[slide_nav_search_bg]',
array(
'label' => esc_html__( 'Search Bar Background Color', 'Divi' ),
'section' => 'et_divi_header_slide',
'settings' => 'et_divi[slide_nav_search_bg]',
)
)
);
$wp_customize->add_setting(
'et_divi[nav_fullwidth]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[nav_fullwidth]',
array(
'label' => esc_html__( 'Make Full Width', 'Divi' ),
'section' => 'et_divi_header_primary',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[hide_primary_logo]',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
)
);
$wp_customize->add_control(
'et_divi[hide_primary_logo]',
array(
'label' => esc_html__( 'Hide Logo Image', 'Divi' ),
'section' => 'et_divi_header_primary',
'type' => 'checkbox',
)
);
$wp_customize->add_setting(
'et_divi[menu_height]',
array(
'default' => '66',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[menu_height]',
array(
'label' => esc_html__( 'Menu Height', 'Divi' ),
'section' => 'et_divi_header_primary',
'type' => 'range',
'input_attrs' => array(
'min' => 30,
'max' => 300,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[logo_height]',
array(
'default' => '54',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new ET_Divi_Range_Option(
$wp_customize,
'et_divi[logo_height]',
array(
'label' => esc_html__( 'Logo Max Height', 'Divi' ),
'section' => 'et_divi_header_primary',
'type' => 'range',
'input_attrs' => array(
'min' => 30,
'max' => 100,
'step' => 1,
),
)
)
);
$wp_customize->add_setting(
'et_divi[menu_margin_top]',
array(
'default' => '0',
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);