Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi
File: functions.php
}
[500] Fix | Delete
?>
[501] Fix | Delete
[502] Fix | Delete
<div class="<?php echo esc_attr( implode( ' ', $container ) ); ?>">
[503] Fix | Delete
<p class="et_pb_page_settings et_pb_page_layout_settings">
[504] Fix | Delete
<label for="et_pb_page_layout" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Page Layout', 'Divi' ); ?>: </label>
[505] Fix | Delete
[506] Fix | Delete
<select id="et_pb_page_layout" name="et_pb_page_layout">
[507] Fix | Delete
<?php
[508] Fix | Delete
foreach ( $page_layouts as $layout_value => $layout_name ) {
[509] Fix | Delete
printf( '<option value="%2$s"%3$s%4$s>%1$s</option>',
[510] Fix | Delete
esc_html( $layout_name ),
[511] Fix | Delete
esc_attr( $layout_value ),
[512] Fix | Delete
selected( $layout_value, $page_layout, false ),
[513] Fix | Delete
'et_full_width_page' === $layout_value && ! $is_builder_active ? ' style="display: none;"' : ''
[514] Fix | Delete
);
[515] Fix | Delete
} ?>
[516] Fix | Delete
</select>
[517] Fix | Delete
</p>
[518] Fix | Delete
<p class="et_pb_page_settings et_pb_side_nav_settings" style="display: none;">
[519] Fix | Delete
<label for="et_pb_side_nav" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Dot Navigation', 'Divi' ); ?>: </label>
[520] Fix | Delete
[521] Fix | Delete
<select id="et_pb_side_nav" name="et_pb_side_nav">
[522] Fix | Delete
<option value="off" <?php selected( 'off', $side_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
[523] Fix | Delete
<option value="on" <?php selected( 'on', $side_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
[524] Fix | Delete
</select>
[525] Fix | Delete
</p>
[526] Fix | Delete
<p class="et_pb_page_settings et_pb_nav_settings">
[527] Fix | Delete
<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>
[528] Fix | Delete
[529] Fix | Delete
<select id="et_pb_post_hide_nav" name="et_pb_post_hide_nav">
[530] Fix | Delete
<option value="default" <?php selected( 'default', $post_hide_nav ); ?>><?php esc_html_e( 'Default', 'Divi' ); ?></option>
[531] Fix | Delete
<option value="no" <?php selected( 'no', $post_hide_nav ); ?>><?php esc_html_e( 'Off', 'Divi' ); ?></option>
[532] Fix | Delete
<option value="on" <?php selected( 'on', $post_hide_nav ); ?>><?php esc_html_e( 'On', 'Divi' ); ?></option>
[533] Fix | Delete
</select>
[534] Fix | Delete
</p>
[535] Fix | Delete
[536] Fix | Delete
<?php if ( 'post' === $post->post_type ) : ?>
[537] Fix | Delete
<p class="et_pb_page_settings et_pb_single_title" style="display: none;">
[538] Fix | Delete
<label for="et_single_title" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Post Title', 'Divi' ); ?>: </label>
[539] Fix | Delete
[540] Fix | Delete
<select id="et_single_title" name="et_single_title">
[541] Fix | Delete
<option value="on" <?php selected( 'on', $show_title ); ?>><?php esc_html_e( 'Show', 'Divi' ); ?></option>
[542] Fix | Delete
<option value="off" <?php selected( 'off', $show_title ); ?>><?php esc_html_e( 'Hide', 'Divi' ); ?></option>
[543] Fix | Delete
</select>
[544] Fix | Delete
</p>
[545] Fix | Delete
[546] Fix | Delete
<p class="et_divi_quote_settings et_divi_audio_settings et_divi_link_settings et_divi_format_setting et_pb_page_settings">
[547] Fix | Delete
<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>
[548] Fix | Delete
<input name="et_post_use_bg_color" type="checkbox" id="et_post_use_bg_color" <?php checked( $post_use_bg_color ); ?> />
[549] Fix | Delete
</p>
[550] Fix | Delete
[551] Fix | Delete
<p class="et_post_bg_color_setting et_divi_format_setting et_pb_page_settings">
[552] Fix | Delete
<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" />
[553] Fix | Delete
</p>
[554] Fix | Delete
[555] Fix | Delete
<p class="et_divi_quote_settings et_divi_audio_settings et_divi_link_settings et_divi_format_setting">
[556] Fix | Delete
<label for="et_post_bg_layout" style="font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Text Color', 'Divi' ); ?>: </label>
[557] Fix | Delete
<select id="et_post_bg_layout" name="et_post_bg_layout">
[558] Fix | Delete
<?php
[559] Fix | Delete
foreach ( $layouts as $layout_name => $layout_title )
[560] Fix | Delete
printf( '<option value="%s"%s>%s</option>',
[561] Fix | Delete
esc_attr( $layout_name ),
[562] Fix | Delete
selected( $layout_name, $post_bg_layout, false ),
[563] Fix | Delete
esc_html( $layout_title )
[564] Fix | Delete
);
[565] Fix | Delete
?>
[566] Fix | Delete
</select>
[567] Fix | Delete
</p>
[568] Fix | Delete
<?php endif;
[569] Fix | Delete
[570] Fix | Delete
if ( 'project' === $post->post_type ) : ?>
[571] Fix | Delete
<p class="et_pb_page_settings et_pb_project_nav" style="display: none;">
[572] Fix | Delete
<label for="et_project_nav" style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Project Navigation', 'Divi' ); ?>: </label>
[573] Fix | Delete
[574] Fix | Delete
<select id="et_project_nav" name="et_project_nav">
[575] Fix | Delete
<option value="off" <?php selected( 'off', $project_nav ); ?>><?php esc_html_e( 'Hide', 'Divi' ); ?></option>
[576] Fix | Delete
<option value="on" <?php selected( 'on', $project_nav ); ?>><?php esc_html_e( 'Show', 'Divi' ); ?></option>
[577] Fix | Delete
</select>
[578] Fix | Delete
</p>
[579] Fix | Delete
<?php endif; ?>
[580] Fix | Delete
[581] Fix | Delete
<?php if ( 'product' === $post->post_type && $is_builder_active ) : ?>
[582] Fix | Delete
<?php
[583] Fix | Delete
$product_page_layouts = et_builder_wc_get_page_layouts( 'Divi' );
[584] Fix | Delete
$product_page_layout = get_post_meta( $post_id, '_et_pb_product_page_layout', true );
[585] Fix | Delete
[586] Fix | Delete
// Get the default set at Builder level when `$product_page_layout` isn't set at single Product page.
[587] Fix | Delete
if ( empty( $product_page_layout ) ) {
[588] Fix | Delete
$product_page_layout = et_get_option( 'et_pb_woocommerce_page_layout' );
[589] Fix | Delete
}
[590] Fix | Delete
?>
[591] Fix | Delete
<p class="et_pb_product_page_settings et_pb_product_page_layout_settings">
[592] Fix | Delete
<label for="et_pb_product_page_layout"
[593] Fix | Delete
style="display: block; font-weight: bold; margin-bottom: 5px;"><?php esc_html_e( 'Product Content', 'Divi' ); ?>
[594] Fix | Delete
: </label>
[595] Fix | Delete
[596] Fix | Delete
<select id="et_pb_product_page_layout" name="et_pb_product_page_layout">
[597] Fix | Delete
<?php
[598] Fix | Delete
foreach ( $product_page_layouts as $layout_value => $layout_name ) {
[599] Fix | Delete
printf( '<option value="%2$s"%3$s>%1$s</option>',
[600] Fix | Delete
esc_html( $layout_name ),
[601] Fix | Delete
esc_attr( $layout_value ),
[602] Fix | Delete
selected( $layout_value, $product_page_layout, false )
[603] Fix | Delete
);
[604] Fix | Delete
}
[605] Fix | Delete
?>
[606] Fix | Delete
</select>
[607] Fix | Delete
</p>
[608] Fix | Delete
<?php endif; ?>
[609] Fix | Delete
</div>
[610] Fix | Delete
<?php
[611] Fix | Delete
}
[612] Fix | Delete
endif;
[613] Fix | Delete
[614] Fix | Delete
function et_divi_post_settings_save_details( $post_id, $post ) {
[615] Fix | Delete
global $pagenow;
[616] Fix | Delete
[617] Fix | Delete
if ( 'post.php' !== $pagenow || ! $post || ! is_object( $post ) ) {
[618] Fix | Delete
return;
[619] Fix | Delete
}
[620] Fix | Delete
[621] Fix | Delete
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
[622] Fix | Delete
return;
[623] Fix | Delete
}
[624] Fix | Delete
[625] Fix | Delete
$post_type = get_post_type_object( $post->post_type );
[626] Fix | Delete
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
[627] Fix | Delete
return;
[628] Fix | Delete
}
[629] Fix | Delete
[630] Fix | Delete
if ( ! isset( $_POST['et_settings_nonce'] ) || ! wp_verify_nonce( $_POST['et_settings_nonce'], basename( __FILE__ ) ) ) {
[631] Fix | Delete
return;
[632] Fix | Delete
}
[633] Fix | Delete
[634] Fix | Delete
if ( isset( $_POST['et_post_use_bg_color'] ) )
[635] Fix | Delete
update_post_meta( $post_id, '_et_post_use_bg_color', true );
[636] Fix | Delete
else
[637] Fix | Delete
delete_post_meta( $post_id, '_et_post_use_bg_color' );
[638] Fix | Delete
[639] Fix | Delete
if ( isset( $_POST['et_post_bg_color'] ) )
[640] Fix | Delete
update_post_meta( $post_id, '_et_post_bg_color', sanitize_text_field( $_POST['et_post_bg_color'] ) );
[641] Fix | Delete
else
[642] Fix | Delete
delete_post_meta( $post_id, '_et_post_bg_color' );
[643] Fix | Delete
[644] Fix | Delete
if ( isset( $_POST['et_post_bg_layout'] ) )
[645] Fix | Delete
update_post_meta( $post_id, '_et_post_bg_layout', sanitize_text_field( $_POST['et_post_bg_layout'] ) );
[646] Fix | Delete
else
[647] Fix | Delete
delete_post_meta( $post_id, '_et_post_bg_layout' );
[648] Fix | Delete
[649] Fix | Delete
if ( isset( $_POST['et_single_title'] ) )
[650] Fix | Delete
update_post_meta( $post_id, '_et_pb_show_title', sanitize_text_field( $_POST['et_single_title'] ) );
[651] Fix | Delete
else
[652] Fix | Delete
delete_post_meta( $post_id, '_et_pb_show_title' );
[653] Fix | Delete
[654] Fix | Delete
if ( isset( $_POST['et_pb_post_hide_nav'] ) )
[655] Fix | Delete
update_post_meta( $post_id, '_et_pb_post_hide_nav', sanitize_text_field( $_POST['et_pb_post_hide_nav'] ) );
[656] Fix | Delete
else
[657] Fix | Delete
delete_post_meta( $post_id, '_et_pb_post_hide_nav' );
[658] Fix | Delete
[659] Fix | Delete
if ( isset( $_POST['et_project_nav'] ) )
[660] Fix | Delete
update_post_meta( $post_id, '_et_pb_project_nav', sanitize_text_field( $_POST['et_project_nav'] ) );
[661] Fix | Delete
else
[662] Fix | Delete
delete_post_meta( $post_id, '_et_pb_project_nav' );
[663] Fix | Delete
[664] Fix | Delete
if ( isset( $_POST['et_pb_page_layout'] ) ) {
[665] Fix | Delete
update_post_meta( $post_id, '_et_pb_page_layout', sanitize_text_field( $_POST['et_pb_page_layout'] ) );
[666] Fix | Delete
} else {
[667] Fix | Delete
delete_post_meta( $post_id, '_et_pb_page_layout' );
[668] Fix | Delete
}
[669] Fix | Delete
[670] Fix | Delete
if ( isset( $_POST['et_pb_side_nav'] ) ) {
[671] Fix | Delete
update_post_meta( $post_id, '_et_pb_side_nav', sanitize_text_field( $_POST['et_pb_side_nav'] ) );
[672] Fix | Delete
} else {
[673] Fix | Delete
delete_post_meta( $post_id, '_et_pb_side_nav' );
[674] Fix | Delete
}
[675] Fix | Delete
[676] Fix | Delete
if ( isset( $_POST['et_pb_product_page_layout'] ) ) {
[677] Fix | Delete
update_post_meta( $post_id, '_et_pb_product_page_layout', sanitize_text_field( $_POST['et_pb_product_page_layout'] ) );
[678] Fix | Delete
} else {
[679] Fix | Delete
delete_post_meta( $post_id, '_et_pb_product_page_layout' );
[680] Fix | Delete
}
[681] Fix | Delete
}
[682] Fix | Delete
add_action( 'save_post', 'et_divi_post_settings_save_details', 10, 2 );
[683] Fix | Delete
[684] Fix | Delete
[685] Fix | Delete
if ( ! function_exists( 'et_get_one_font_languages' ) ) :
[686] Fix | Delete
/**
[687] Fix | Delete
* Return the list of languages which support one font
[688] Fix | Delete
*
[689] Fix | Delete
* @deprecated 4.8
[690] Fix | Delete
*
[691] Fix | Delete
* @return array
[692] Fix | Delete
*/
[693] Fix | Delete
function et_get_one_font_languages() {
[694] Fix | Delete
_deprecated_function( __FUNCTION__, '4.8', null );
[695] Fix | Delete
[696] Fix | Delete
$one_font_languages = array(
[697] Fix | Delete
'ja' => array(
[698] Fix | Delete
'language_name' => 'Japanese',
[699] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
[700] Fix | Delete
'font_family' => "'Noto Sans Japanese', serif",
[701] Fix | Delete
),
[702] Fix | Delete
'ko_KR' => array(
[703] Fix | Delete
'language_name' => 'Korean',
[704] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
[705] Fix | Delete
'font_family' => "'Hanna', serif",
[706] Fix | Delete
),
[707] Fix | Delete
'ms_MY' => array(
[708] Fix | Delete
'language_name' => 'Malay',
[709] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
[710] Fix | Delete
'font_family' => "'Noto Sans Malayalam', serif",
[711] Fix | Delete
),
[712] Fix | Delete
'zh_CN' => array(
[713] Fix | Delete
'language_name' => 'Chinese',
[714] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
[715] Fix | Delete
'font_family' => "'cwTeXFangSong', serif",
[716] Fix | Delete
),
[717] Fix | Delete
);
[718] Fix | Delete
[719] Fix | Delete
return $one_font_languages;
[720] Fix | Delete
}
[721] Fix | Delete
endif;
[722] Fix | Delete
[723] Fix | Delete
if ( ! function_exists( 'et_get_old_one_font_languages' ) ) :
[724] Fix | Delete
/**
[725] Fix | Delete
* Return the list of languages which supported one font previously.
[726] Fix | Delete
*
[727] Fix | Delete
* @return array
[728] Fix | Delete
*/
[729] Fix | Delete
function et_get_old_one_font_languages() {
[730] Fix | Delete
$old_one_font_languages = array(
[731] Fix | Delete
'he_IL' => array(
[732] Fix | Delete
'language_name' => 'Hebrew',
[733] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/alefhebrew.css',
[734] Fix | Delete
'font_family' => 'Alef Hebrew',
[735] Fix | Delete
),
[736] Fix | Delete
'ar' => array(
[737] Fix | Delete
'language_name' => 'Arabic',
[738] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/lateef.css',
[739] Fix | Delete
'font_family' => 'Lateef',
[740] Fix | Delete
),
[741] Fix | Delete
'th' => array(
[742] Fix | Delete
'language_name' => 'Thai',
[743] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansthai.css',
[744] Fix | Delete
'font_family' => 'Noto Sans Thai',
[745] Fix | Delete
),
[746] Fix | Delete
'ja' => array(
[747] Fix | Delete
'language_name' => 'Japanese',
[748] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansjapanese.css',
[749] Fix | Delete
'font_family' => 'Noto Sans Japanese',
[750] Fix | Delete
),
[751] Fix | Delete
'ko_KR' => array(
[752] Fix | Delete
'language_name' => 'Korean',
[753] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/hanna.css',
[754] Fix | Delete
'font_family' => 'Hanna',
[755] Fix | Delete
),
[756] Fix | Delete
'ml_IN' => array(
[757] Fix | Delete
'language_name' => 'Malayalam',
[758] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/notosansmalayalam.css',
[759] Fix | Delete
'font_family' => 'Noto Sans Malayalam',
[760] Fix | Delete
),
[761] Fix | Delete
'zh_CN' => array(
[762] Fix | Delete
'language_name' => 'Chinese',
[763] Fix | Delete
'google_font_url' => '//fonts.googleapis.com/earlyaccess/cwtexfangsong.css',
[764] Fix | Delete
'font_family' => 'cwTeXFangSong',
[765] Fix | Delete
),
[766] Fix | Delete
);
[767] Fix | Delete
[768] Fix | Delete
return $old_one_font_languages;
[769] Fix | Delete
}
[770] Fix | Delete
endif;
[771] Fix | Delete
[772] Fix | Delete
/**
[773] Fix | Delete
* Return custom default font-family for the languages which supported one font previously
[774] Fix | Delete
* @param string
[775] Fix | Delete
* @return string
[776] Fix | Delete
*/
[777] Fix | Delete
if ( ! function_exists( 'et_pb_get_specific_default_font' ) ) :
[778] Fix | Delete
function et_pb_get_specific_default_font( $font_family ) {
[779] Fix | Delete
// do nothing if font is not default
[780] Fix | Delete
if ( ! in_array( $font_family, array( 'none', '' ) ) ) {
[781] Fix | Delete
return $font_family;
[782] Fix | Delete
}
[783] Fix | Delete
[784] Fix | Delete
$site_domain = get_locale();
[785] Fix | Delete
[786] Fix | Delete
// array of the languages which were "one font languages" earlier and have specific defaults
[787] Fix | Delete
$specific_defaults = et_get_old_one_font_languages();
[788] Fix | Delete
[789] Fix | Delete
if ( isset( $specific_defaults[ $site_domain ] ) ) {
[790] Fix | Delete
return $specific_defaults[ $site_domain ]['font_family'];
[791] Fix | Delete
}
[792] Fix | Delete
[793] Fix | Delete
return $font_family;
[794] Fix | Delete
}
[795] Fix | Delete
endif;
[796] Fix | Delete
[797] Fix | Delete
function et_divi_customize_register( $wp_customize ) {
[798] Fix | Delete
global $wp_version;
[799] Fix | Delete
[800] Fix | Delete
// Get WP major version
[801] Fix | Delete
$wp_major_version = substr( $wp_version, 0, 3 );
[802] Fix | Delete
[803] Fix | Delete
$wp_customize->remove_section( 'title_tagline' );
[804] Fix | Delete
$wp_customize->remove_section( 'background_image' );
[805] Fix | Delete
$wp_customize->remove_section( 'colors' );
[806] Fix | Delete
$wp_customize->register_control_type( 'ET_Divi_Customize_Color_Alpha_Control' );
[807] Fix | Delete
[808] Fix | Delete
if ( version_compare( $wp_major_version, '4.9', '>=' ) ) {
[809] Fix | Delete
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' ) );
[810] Fix | Delete
wp_localize_script( 'wp-color-picker-alpha', 'et_pb_color_picker_strings', apply_filters( 'et_pb_color_picker_strings_builder', array(
[811] Fix | Delete
'legacy_pick' => esc_html__( 'Select', 'et_builder' ),
[812] Fix | Delete
'legacy_current' => esc_html__( 'Current Color', 'et_builder' ),
[813] Fix | Delete
) ) );
[814] Fix | Delete
} else {
[815] Fix | Delete
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' ) );
[816] Fix | Delete
}
[817] Fix | Delete
[818] Fix | Delete
$option_set_name = 'et_customizer_option_set';
[819] Fix | Delete
$option_set_allowed_values = apply_filters( 'et_customizer_option_set_allowed_values', array( 'module', 'theme' ) );
[820] Fix | Delete
[821] Fix | Delete
$customizer_option_set = '';
[822] Fix | Delete
[823] Fix | Delete
/**
[824] Fix | Delete
* Set a transient,
[825] Fix | Delete
* if 'et_customizer_option_set' query parameter is set to one of the allowed values
[826] Fix | Delete
*/
[827] Fix | Delete
if ( isset( $_GET[ $option_set_name ] ) && in_array( $_GET[ $option_set_name ], $option_set_allowed_values ) ) {
[828] Fix | Delete
$customizer_option_set = $_GET[ $option_set_name ];
[829] Fix | Delete
[830] Fix | Delete
set_transient( 'et_divi_customizer_option_set', $customizer_option_set, DAY_IN_SECONDS );
[831] Fix | Delete
}
[832] Fix | Delete
[833] Fix | Delete
if ( '' === $customizer_option_set && ( $et_customizer_option_set_value = get_transient( 'et_divi_customizer_option_set' ) ) ) {
[834] Fix | Delete
$customizer_option_set = $et_customizer_option_set_value;
[835] Fix | Delete
}
[836] Fix | Delete
[837] Fix | Delete
et_builder_init_global_settings();
[838] Fix | Delete
[839] Fix | Delete
// Determine if current request is Design Preview Link. Design Preview Link was added on
[840] Fix | Delete
// WordPress 4.9 and enables user to share customizer change without the need to publish the
[841] Fix | Delete
// customizer change first: save customizer change as draft, copy the link, and share it with
[842] Fix | Delete
// collaborator. Design Preview Link works on non-logged in user
[843] Fix | Delete
// @see https://codex.wordpress.org/Version_4.9
[844] Fix | Delete
$is_customizer_public_shared_link = ! is_admin() && is_customize_preview() && ! $wp_customize->get_messenger_channel();
[845] Fix | Delete
[846] Fix | Delete
// display wp error screen if theme customizer disabled for current user
[847] Fix | Delete
if ( ! et_pb_is_allowed( 'theme_customizer' ) && ! $is_customizer_public_shared_link ) {
[848] Fix | Delete
wp_die( esc_html__( "you don't have sufficient permissions to access this page", 'Divi' ) );
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
et_divi_customizer_theme_settings( $wp_customize );
[852] Fix | Delete
}
[853] Fix | Delete
add_action( 'customize_register', 'et_divi_customize_register' );
[854] Fix | Delete
[855] Fix | Delete
if ( ! function_exists( 'et_divi_customizer_theme_settings' ) ) :
[856] Fix | Delete
/**
[857] Fix | Delete
* Add our customizer settings.
[858] Fix | Delete
*
[859] Fix | Delete
* @param \WP_Customize_Manager $wp_customize WP_Customize_Manager object.
[860] Fix | Delete
*/
[861] Fix | Delete
function et_divi_customizer_theme_settings( $wp_customize ) {
[862] Fix | Delete
$site_domain = get_locale();
[863] Fix | Delete
[864] Fix | Delete
$google_fonts = et_builder_get_fonts(
[865] Fix | Delete
array(
[866] Fix | Delete
'prepend_standard_fonts' => false,
[867] Fix | Delete
)
[868] Fix | Delete
);
[869] Fix | Delete
[870] Fix | Delete
$user_fonts = et_builder_get_custom_fonts();
[871] Fix | Delete
[872] Fix | Delete
// combine google fonts with custom user fonts.
[873] Fix | Delete
$google_fonts = array_merge( $user_fonts, $google_fonts );
[874] Fix | Delete
[875] Fix | Delete
$et_domain_fonts = array(
[876] Fix | Delete
'ru_RU' => 'cyrillic',
[877] Fix | Delete
'uk' => 'cyrillic',
[878] Fix | Delete
'bg_BG' => 'cyrillic',
[879] Fix | Delete
'vi' => 'vietnamese',
[880] Fix | Delete
'el' => 'greek',
[881] Fix | Delete
'ar' => 'arabic',
[882] Fix | Delete
'he_IL' => 'hebrew',
[883] Fix | Delete
'th' => 'thai',
[884] Fix | Delete
'si_lk' => 'sinhala',
[885] Fix | Delete
'bn_bd' => 'bengali',
[886] Fix | Delete
'ta_lk' => 'tamil',
[887] Fix | Delete
'te' => 'telegu',
[888] Fix | Delete
'km' => 'khmer',
[889] Fix | Delete
'kn' => 'kannada',
[890] Fix | Delete
'ml_in' => 'malayalam',
[891] Fix | Delete
'ja' => 'japanese',
[892] Fix | Delete
'ko_KR' => 'korean',
[893] Fix | Delete
'ml_IN' => 'malayalam',
[894] Fix | Delete
'zh_CN' => 'chinese-simplified',
[895] Fix | Delete
);
[896] Fix | Delete
[897] Fix | Delete
$font_choices = array();
[898] Fix | Delete
$font_choices['none'] = array(
[899] Fix | Delete
'label' => 'Default Theme Font',
[900] Fix | Delete
);
[901] Fix | Delete
[902] Fix | Delete
$removed_fonts_mapping = et_builder_old_fonts_mapping();
[903] Fix | Delete
[904] Fix | Delete
foreach ( $google_fonts as $google_font_name => $google_font_properties ) {
[905] Fix | Delete
$use_parent_font = false;
[906] Fix | Delete
[907] Fix | Delete
if ( isset( $removed_fonts_mapping[ $google_font_name ] ) ) {
[908] Fix | Delete
$parent_font = $removed_fonts_mapping[ $google_font_name ]['parent_font'];
[909] Fix | Delete
$google_font_properties['character_set'] = $google_fonts[ $parent_font ]['character_set'];
[910] Fix | Delete
$use_parent_font = true;
[911] Fix | Delete
}
[912] Fix | Delete
[913] Fix | Delete
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 ] ) ) {
[914] Fix | Delete
continue;
[915] Fix | Delete
}
[916] Fix | Delete
[917] Fix | Delete
$font_choices[ $google_font_name ] = array(
[918] Fix | Delete
'label' => $google_font_name,
[919] Fix | Delete
'data' => array(
[920] Fix | Delete
'parent_font' => $use_parent_font ? $google_font_properties['parent_font'] : '',
[921] Fix | Delete
'parent_styles' => $use_parent_font ? $google_fonts[ $parent_font ]['styles'] : $google_font_properties['styles'],
[922] Fix | Delete
'current_styles' => $use_parent_font && isset( $google_fonts[ $parent_font ]['styles'] ) && isset( $google_font_properties['styles'] ) ? $google_font_properties['styles'] : '',
[923] Fix | Delete
'parent_subset' => $use_parent_font && isset( $google_fonts[ $parent_font ]['character_set'] ) ? $google_fonts[ $parent_font ]['character_set'] : '',
[924] Fix | Delete
'standard' => isset( $google_font_properties['standard'] ) && $google_font_properties['standard'] ? 'on' : 'off',
[925] Fix | Delete
),
[926] Fix | Delete
);
[927] Fix | Delete
}
[928] Fix | Delete
[929] Fix | Delete
$wp_customize->add_panel(
[930] Fix | Delete
'et_divi_general_settings',
[931] Fix | Delete
array(
[932] Fix | Delete
'title' => esc_html__( 'General Settings', 'Divi' ),
[933] Fix | Delete
'priority' => 1,
[934] Fix | Delete
)
[935] Fix | Delete
);
[936] Fix | Delete
[937] Fix | Delete
$wp_customize->add_section(
[938] Fix | Delete
'title_tagline',
[939] Fix | Delete
array(
[940] Fix | Delete
'title' => esc_html__( 'Site Identity', 'Divi' ),
[941] Fix | Delete
'panel' => 'et_divi_general_settings',
[942] Fix | Delete
)
[943] Fix | Delete
);
[944] Fix | Delete
[945] Fix | Delete
$wp_customize->add_section(
[946] Fix | Delete
'et_divi_general_layout',
[947] Fix | Delete
array(
[948] Fix | Delete
'title' => esc_html__( 'Layout Settings', 'Divi' ),
[949] Fix | Delete
'panel' => 'et_divi_general_settings',
[950] Fix | Delete
)
[951] Fix | Delete
);
[952] Fix | Delete
[953] Fix | Delete
$wp_customize->add_section(
[954] Fix | Delete
'et_divi_general_typography',
[955] Fix | Delete
array(
[956] Fix | Delete
'title' => esc_html__( 'Typography', 'Divi' ),
[957] Fix | Delete
'panel' => 'et_divi_general_settings',
[958] Fix | Delete
)
[959] Fix | Delete
);
[960] Fix | Delete
[961] Fix | Delete
$wp_customize->add_panel(
[962] Fix | Delete
'et_divi_mobile',
[963] Fix | Delete
array(
[964] Fix | Delete
'title' => esc_html__( 'Mobile Styles', 'Divi' ),
[965] Fix | Delete
'priority' => 6,
[966] Fix | Delete
)
[967] Fix | Delete
);
[968] Fix | Delete
[969] Fix | Delete
$wp_customize->add_section(
[970] Fix | Delete
'et_divi_mobile_tablet',
[971] Fix | Delete
array(
[972] Fix | Delete
'title' => esc_html__( 'Tablet', 'Divi' ),
[973] Fix | Delete
'panel' => 'et_divi_mobile',
[974] Fix | Delete
)
[975] Fix | Delete
);
[976] Fix | Delete
[977] Fix | Delete
$wp_customize->add_section(
[978] Fix | Delete
'et_divi_mobile_phone',
[979] Fix | Delete
array(
[980] Fix | Delete
'title' => esc_html__( 'Phone', 'Divi' ),
[981] Fix | Delete
'panel' => 'et_divi_mobile',
[982] Fix | Delete
)
[983] Fix | Delete
);
[984] Fix | Delete
[985] Fix | Delete
$wp_customize->add_section(
[986] Fix | Delete
'et_divi_mobile_menu',
[987] Fix | Delete
array(
[988] Fix | Delete
'title' => esc_html__( 'Mobile Menu', 'Divi' ),
[989] Fix | Delete
'panel' => 'et_divi_mobile',
[990] Fix | Delete
)
[991] Fix | Delete
);
[992] Fix | Delete
[993] Fix | Delete
$wp_customize->add_section(
[994] Fix | Delete
'et_divi_general_background',
[995] Fix | Delete
array(
[996] Fix | Delete
'title' => esc_html__( 'Background', 'Divi' ),
[997] Fix | Delete
'panel' => 'et_divi_general_settings',
[998] Fix | Delete
)
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function