Edit File by line
/home/barbar84/public_h.../wp-conte.../themes/Divi
File: functions.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
if ( ! isset( $content_width ) ) $content_width = 1080;
[3] Fix | Delete
[4] Fix | Delete
function et_setup_theme() {
[5] Fix | Delete
global $themename, $shortname, $et_store_options_in_one_row, $default_colorscheme;
[6] Fix | Delete
$themename = 'Divi';
[7] Fix | Delete
$shortname = 'divi';
[8] Fix | Delete
$et_store_options_in_one_row = true;
[9] Fix | Delete
[10] Fix | Delete
$default_colorscheme = "Default";
[11] Fix | Delete
[12] Fix | Delete
$template_directory = get_template_directory();
[13] Fix | Delete
[14] Fix | Delete
require_once( $template_directory . '/core/init.php' );
[15] Fix | Delete
[16] Fix | Delete
et_core_setup( get_template_directory_uri() );
[17] Fix | Delete
[18] Fix | Delete
if ( '3.0.61' === ET_CORE_VERSION ) {
[19] Fix | Delete
require_once $template_directory . '/core/functions.php';
[20] Fix | Delete
require_once $template_directory . '/core/components/init.php';
[21] Fix | Delete
et_core_patch_core_3061();
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
require_once( $template_directory . '/epanel/custom_functions.php' );
[25] Fix | Delete
[26] Fix | Delete
require_once( $template_directory . '/includes/functions/choices.php' );
[27] Fix | Delete
[28] Fix | Delete
require_once( $template_directory . '/includes/functions/sanitization.php' );
[29] Fix | Delete
[30] Fix | Delete
require_once( $template_directory . '/includes/functions/sidebars.php' );
[31] Fix | Delete
[32] Fix | Delete
load_theme_textdomain( 'Divi', $template_directory . '/lang' );
[33] Fix | Delete
[34] Fix | Delete
require_once( $template_directory . '/epanel/core_functions.php' );
[35] Fix | Delete
[36] Fix | Delete
require_once( $template_directory . '/post_thumbnails_divi.php' );
[37] Fix | Delete
[38] Fix | Delete
include_once( $template_directory . '/includes/widgets.php' );
[39] Fix | Delete
[40] Fix | Delete
register_nav_menus( array(
[41] Fix | Delete
'primary-menu' => esc_html__( 'Primary Menu', 'Divi' ),
[42] Fix | Delete
'secondary-menu' => esc_html__( 'Secondary Menu', 'Divi' ),
[43] Fix | Delete
'footer-menu' => esc_html__( 'Footer Menu', 'Divi' ),
[44] Fix | Delete
) );
[45] Fix | Delete
[46] Fix | Delete
// don't display the empty title bar if the widget title is not set
[47] Fix | Delete
remove_filter( 'widget_title', 'et_widget_force_title' );
[48] Fix | Delete
[49] Fix | Delete
remove_filter( 'body_class', 'et_add_fullwidth_body_class' );
[50] Fix | Delete
[51] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_add_responsive_shortcodes_css', 11 );
[52] Fix | Delete
[53] Fix | Delete
// Declare theme supports
[54] Fix | Delete
add_theme_support( 'title-tag' );
[55] Fix | Delete
[56] Fix | Delete
add_theme_support( 'post-formats', array(
[57] Fix | Delete
'video', 'audio', 'quote', 'gallery', 'link'
[58] Fix | Delete
) );
[59] Fix | Delete
[60] Fix | Delete
add_theme_support( 'woocommerce' );
[61] Fix | Delete
add_theme_support( 'wc-product-gallery-zoom' );
[62] Fix | Delete
add_theme_support( 'wc-product-gallery-lightbox' );
[63] Fix | Delete
add_theme_support( 'wc-product-gallery-slider' );
[64] Fix | Delete
[65] Fix | Delete
add_theme_support( 'customize-selective-refresh-widgets' );
[66] Fix | Delete
[67] Fix | Delete
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
[68] Fix | Delete
[69] Fix | Delete
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
[70] Fix | Delete
add_action( 'woocommerce_before_main_content', 'et_divi_output_content_wrapper', 10 );
[71] Fix | Delete
add_action( 'eventon_before_main_content', 'et_divi_output_content_wrapper', 11 );
[72] Fix | Delete
[73] Fix | Delete
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
[74] Fix | Delete
add_action( 'woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10 );
[75] Fix | Delete
add_action( 'eventon_after_main_content', 'et_divi_output_content_wrapper_end', 9 );
[76] Fix | Delete
[77] Fix | Delete
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
[78] Fix | Delete
[79] Fix | Delete
// add wrapper so we can clear things
[80] Fix | Delete
add_action( 'woocommerce_before_single_product_summary', 'et_divi_output_product_wrapper', 0 );
[81] Fix | Delete
add_action( 'woocommerce_after_single_product_summary', 'et_divi_output_product_wrapper_end', 0 );
[82] Fix | Delete
[83] Fix | Delete
// deactivate page templates and custom import functions
[84] Fix | Delete
remove_action( 'init', 'et_activate_features' );
[85] Fix | Delete
[86] Fix | Delete
remove_action('admin_menu', 'et_add_epanel');
[87] Fix | Delete
[88] Fix | Delete
// Load editor styling
[89] Fix | Delete
add_editor_style( 'css/editor-style.css' );
[90] Fix | Delete
add_editor_style( 'css/editor-blocks.css' );
[91] Fix | Delete
[92] Fix | Delete
// Load unminified scripts based on selected theme options field
[93] Fix | Delete
add_filter( 'et_load_unminified_scripts', 'et_divi_load_unminified_scripts' );
[94] Fix | Delete
[95] Fix | Delete
// Load unminified styles based on selected theme options field
[96] Fix | Delete
add_filter( 'et_load_unminified_styles', 'et_divi_load_unminified_styles' );
[97] Fix | Delete
[98] Fix | Delete
et_divi_version_rollback()->enable();
[99] Fix | Delete
[100] Fix | Delete
if ( wp_doing_cron() ) {
[101] Fix | Delete
et_register_updates_component();
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
add_action( 'after_setup_theme', 'et_setup_theme' );
[105] Fix | Delete
[106] Fix | Delete
function et_divi_load_unminified_scripts( $load ) {
[107] Fix | Delete
/** @see ET_Core_SupportCenter::toggle_safe_mode */
[108] Fix | Delete
if ( et_core_is_safe_mode_active() ) {
[109] Fix | Delete
return true;
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( 'false' === et_get_option( 'divi_minify_combine_scripts' ) ) {
[113] Fix | Delete
return true;
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
return $load;
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
function et_divi_load_unminified_styles( $load ) {
[120] Fix | Delete
/** @see ET_Core_SupportCenter::toggle_safe_mode */
[121] Fix | Delete
if ( et_core_is_safe_mode_active() ) {
[122] Fix | Delete
return true;
[123] Fix | Delete
}
[124] Fix | Delete
[125] Fix | Delete
if ( 'false' === et_get_option( 'divi_minify_combine_styles' ) ) {
[126] Fix | Delete
return true;
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
return $load;
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
function et_theme_epanel_reminder(){
[133] Fix | Delete
global $shortname, $themename;
[134] Fix | Delete
[135] Fix | Delete
$documentation_url = 'http://www.elegantthemes.com/gallery/divi/readme.html';
[136] Fix | Delete
$documentation_option_name = $shortname . '_2_4_documentation_message';
[137] Fix | Delete
[138] Fix | Delete
if ( false === et_get_option( $shortname . '_logo' ) && false === et_get_option( $documentation_option_name ) ) {
[139] Fix | Delete
$message = sprintf(
[140] Fix | Delete
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 ) ),
[141] Fix | Delete
esc_url( $documentation_url )
[142] Fix | Delete
);
[143] Fix | Delete
[144] Fix | Delete
printf(
[145] Fix | Delete
'<div class="notice is-dismissible" style="background-color: #6C2EB9; color: #fff; border-left: none;">
[146] Fix | Delete
<p>%1$s</p>
[147] Fix | Delete
</div>',
[148] Fix | Delete
$message
[149] Fix | Delete
);
[150] Fix | Delete
[151] Fix | Delete
et_update_option( $documentation_option_name, 'triggered' );
[152] Fix | Delete
}
[153] Fix | Delete
}
[154] Fix | Delete
add_action( 'admin_notices', 'et_theme_epanel_reminder' );
[155] Fix | Delete
[156] Fix | Delete
if ( ! function_exists( 'et_divi_fonts_url' ) ) :
[157] Fix | Delete
function et_divi_fonts_url() {
[158] Fix | Delete
if ( ! et_core_use_google_fonts() ) {
[159] Fix | Delete
return '';
[160] Fix | Delete
}
[161] Fix | Delete
[162] Fix | Delete
$fonts_url = '';
[163] Fix | Delete
[164] Fix | Delete
/* Translators: If there are characters in your language that are not
[165] Fix | Delete
* supported by Open Sans, translate this to 'off'. Do not translate
[166] Fix | Delete
* into your own language.
[167] Fix | Delete
*/
[168] Fix | Delete
$open_sans = _x( 'on', 'Open Sans font: on or off', 'Divi' );
[169] Fix | Delete
[170] Fix | Delete
if ( 'off' !== $open_sans ) {
[171] Fix | Delete
$font_families = array();
[172] Fix | Delete
[173] Fix | Delete
if ( 'off' !== $open_sans )
[174] Fix | Delete
$font_families[] = 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800';
[175] Fix | Delete
[176] Fix | Delete
$protocol = is_ssl() ? 'https' : 'http';
[177] Fix | Delete
$query_args = array(
[178] Fix | Delete
'family' => implode( '%7C', $font_families ),
[179] Fix | Delete
'subset' => 'latin,latin-ext',
[180] Fix | Delete
'display' => 'swap',
[181] Fix | Delete
);
[182] Fix | Delete
$fonts_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
return $fonts_url;
[186] Fix | Delete
}
[187] Fix | Delete
endif;
[188] Fix | Delete
[189] Fix | Delete
function et_divi_load_fonts() {
[190] Fix | Delete
$fonts_url = et_divi_fonts_url();
[191] Fix | Delete
[192] Fix | Delete
// Get user selected font defined on customizer
[193] Fix | Delete
$et_gf_body_font = sanitize_text_field( et_get_option( 'body_font', 'none' ) );
[194] Fix | Delete
[195] Fix | Delete
$is_et_fb_enabled = function_exists( 'et_fb_enabled' ) && et_fb_enabled();
[196] Fix | Delete
[197] Fix | Delete
// Determine whether current page needs Open Sans or not
[198] Fix | Delete
$no_open_sans = ! is_customize_preview() && 'none' !== $et_gf_body_font && '' !== $et_gf_body_font && ! $is_et_fb_enabled;
[199] Fix | Delete
[200] Fix | Delete
if ( ! empty( $fonts_url ) && ! $no_open_sans ) {
[201] Fix | Delete
wp_enqueue_style( 'divi-fonts', esc_url_raw( $fonts_url ), array(), null );
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_divi_load_fonts' );
[205] Fix | Delete
[206] Fix | Delete
function et_add_home_link( $args ) {
[207] Fix | Delete
// add Home link to the custom menu WP-Admin page
[208] Fix | Delete
$args['show_home'] = true;
[209] Fix | Delete
return $args;
[210] Fix | Delete
}
[211] Fix | Delete
add_filter( 'wp_page_menu_args', 'et_add_home_link' );
[212] Fix | Delete
[213] Fix | Delete
function et_divi_load_scripts_styles(){
[214] Fix | Delete
global $wp_styles, $et_user_fonts_queue;
[215] Fix | Delete
[216] Fix | Delete
$script_suffix = et_load_unminified_scripts() ? '' : '.unified';
[217] Fix | Delete
$style_suffix = et_load_unminified_styles() && ! is_child_theme() ? '.dev' : '';
[218] Fix | Delete
$template_dir = get_template_directory_uri();
[219] Fix | Delete
$theme_version = et_get_theme_version();
[220] Fix | Delete
[221] Fix | Delete
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
[222] Fix | Delete
wp_enqueue_script( 'comment-reply' );
[223] Fix | Delete
[224] Fix | Delete
if ( is_singular() && has_post_format( 'audio' ) ) {
[225] Fix | Delete
wp_enqueue_style( 'wp-mediaelement' );
[226] Fix | Delete
wp_enqueue_script( 'wp-mediaelement' );
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
$dependencies_array = array( 'jquery' );
[230] Fix | Delete
[231] Fix | Delete
// load 'jquery-effects-core' if SlideIn/Fullscreen header used or if customizer opened
[232] Fix | Delete
if ( is_customize_preview() || 'slide' === et_get_option( 'header_style', 'left' ) || 'fullscreen' === et_get_option( 'header_style', 'left' ) ) {
[233] Fix | Delete
$dependencies_array[] = 'jquery-effects-core';
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
wp_enqueue_script( 'et-jquery-touch-mobile', $template_dir . '/includes/builder/scripts/ext/jquery.mobile.custom.min.js', array( 'jquery' ), $theme_version, true );
[237] Fix | Delete
[238] Fix | Delete
if ( et_load_unminified_scripts() ) {
[239] Fix | Delete
$dependencies_array[] = 'et-jquery-touch-mobile';
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
wp_enqueue_script( 'divi-custom-script', $template_dir . '/js/custom' . $script_suffix . '.js', $dependencies_array , $theme_version, true );
[243] Fix | Delete
[244] Fix | Delete
$divi_data = array(
[245] Fix | Delete
'item_count' => esc_html__( '%d Item', 'divi' ),
[246] Fix | Delete
'items_count' => esc_html__( '%d Items', 'divi' ),
[247] Fix | Delete
);
[248] Fix | Delete
[249] Fix | Delete
if ( et_core_is_fb_enabled() ) {
[250] Fix | Delete
$divi_data['row_selector'] = et_divi_get_row_advanced_options_selector_replacement();
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
wp_localize_script( 'divi-custom-script', 'DIVI', $divi_data );
[254] Fix | Delete
[255] Fix | Delete
if ( 'on' === et_get_option( 'divi_smooth_scroll', false ) ) {
[256] Fix | Delete
wp_enqueue_script( 'smooth-scroll', $template_dir . '/js/smoothscroll.js', array( 'jquery' ), $theme_version, true );
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
$et_gf_enqueue_fonts = array();
[260] Fix | Delete
$et_gf_heading_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'heading_font', 'none' ) ) );
[261] Fix | Delete
$et_gf_body_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'body_font', 'none' ) ) );
[262] Fix | Delete
$et_gf_button_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'all_buttons_font', 'none' ) ) );
[263] Fix | Delete
$et_gf_primary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'primary_nav_font', 'none' ) ) );
[264] Fix | Delete
$et_gf_secondary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'secondary_nav_font', 'none' ) ) );
[265] Fix | Delete
$et_gf_slide_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'slide_nav_font', 'none' ) ) );
[266] Fix | Delete
[267] Fix | Delete
if ( 'none' != $et_gf_heading_font ) $et_gf_enqueue_fonts[] = $et_gf_heading_font;
[268] Fix | Delete
if ( 'none' != $et_gf_body_font ) $et_gf_enqueue_fonts[] = $et_gf_body_font;
[269] Fix | Delete
if ( 'none' != $et_gf_button_font ) $et_gf_enqueue_fonts[] = $et_gf_button_font;
[270] Fix | Delete
if ( 'none' != $et_gf_primary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
[271] Fix | Delete
if ( 'none' != $et_gf_secondary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
[272] Fix | Delete
if ( 'none' != $et_gf_slide_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_slide_nav_font;
[273] Fix | Delete
[274] Fix | Delete
if ( ! empty( $et_gf_enqueue_fonts ) && function_exists( 'et_builder_enqueue_font' ) ) {
[275] Fix | Delete
$site_domain = get_locale();
[276] Fix | Delete
$et_old_one_font_languages = et_get_old_one_font_languages();
[277] Fix | Delete
[278] Fix | Delete
foreach ( $et_gf_enqueue_fonts as $single_font ) {
[279] Fix | Delete
if ( isset( $et_old_one_font_languages[$site_domain] ) ) {
[280] Fix | Delete
$font_custom_default_data = $et_old_one_font_languages[$site_domain];
[281] Fix | Delete
[282] Fix | Delete
// enqueue custom default font if needed
[283] Fix | Delete
if ( $single_font === $font_custom_default_data['font_family'] ) {
[284] Fix | Delete
$et_gf_font_name_slug = strtolower( str_replace( ' ', '-', $font_custom_default_data['language_name'] ) );
[285] Fix | Delete
wp_enqueue_style( 'et-gf-' . $et_gf_font_name_slug, $font_custom_default_data['google_font_url'], array(), null );
[286] Fix | Delete
continue;
[287] Fix | Delete
}
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
et_builder_enqueue_font( $single_font );
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
if ( function_exists( 'et_builder_enqueue_user_fonts' ) && ! empty( $et_user_fonts_queue ) ) {
[294] Fix | Delete
printf( '<style id="et-divi-userfonts">%1$s</style>', et_core_esc_previously( et_builder_enqueue_user_fonts( $et_user_fonts_queue ) ) );
[295] Fix | Delete
}
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
/*
[299] Fix | Delete
* Loads the main stylesheet.
[300] Fix | Delete
*/
[301] Fix | Delete
wp_enqueue_style( 'divi-style', get_stylesheet_directory_uri() . '/style' . $style_suffix . '.css', array(), $theme_version );
[302] Fix | Delete
}
[303] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_divi_load_scripts_styles' );
[304] Fix | Delete
[305] Fix | Delete
/**
[306] Fix | Delete
* Switch out the style.css for style-cpt.css when viewing the singular view of a custom post type.
[307] Fix | Delete
* Necessary for child theme support so they don't have to implement this logic.
[308] Fix | Delete
* Hooks at 99999998 so et_builder_dequeue_minifieds_styles() runs after this.
[309] Fix | Delete
*/
[310] Fix | Delete
function et_divi_replace_stylesheet() {
[311] Fix | Delete
// Apply to Custom Post Types when Builder used only.
[312] Fix | Delete
if ( is_search() || ! et_builder_is_custom_post_type_archive() && ( ! et_builder_post_is_of_custom_post_type( get_the_ID() ) || ! et_pb_is_pagebuilder_used( get_the_ID() ) ) ) {
[313] Fix | Delete
return;
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
$template_directory_uri = preg_quote( get_template_directory_uri(), '/' );
[317] Fix | Delete
$theme_style = '/^(' . $template_directory_uri . '\/style)(\.dev)?(\.css)$/';
[318] Fix | Delete
$theme_style_cpt = '$1-cpt$2$3';
[319] Fix | Delete
[320] Fix | Delete
et_core_replace_enqueued_style( $theme_style, $theme_style_cpt, true );
[321] Fix | Delete
}
[322] Fix | Delete
add_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 );
[323] Fix | Delete
[324] Fix | Delete
function et_divi_shortcodes_strings_handle( $handle ) {
[325] Fix | Delete
return et_load_unminified_scripts() ? $handle : 'divi-custom-script';
[326] Fix | Delete
}
[327] Fix | Delete
add_filter( 'et_shortcodes_strings_handle', 'et_divi_shortcodes_strings_handle' );
[328] Fix | Delete
[329] Fix | Delete
function et_divi_builder_modules_script_handle( $handle ) {
[330] Fix | Delete
return et_load_unminified_scripts() ? $handle : 'divi-custom-script';
[331] Fix | Delete
}
[332] Fix | Delete
add_filter( 'et_builder_modules_script_handle', 'et_divi_builder_modules_script_handle' );
[333] Fix | Delete
[334] Fix | Delete
function et_divi_builder_optimized_style_handle( $handle ) {
[335] Fix | Delete
return et_load_unminified_styles() ? $handle : 'divi-style';
[336] Fix | Delete
}
[337] Fix | Delete
add_filter( 'et_builder_optimized_style_handle', 'et_divi_builder_optimized_style_handle' );
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* Added theme specific scripts that are being minified
[341] Fix | Delete
* @param array of scripts
[342] Fix | Delete
* @return array of modified scripts
[343] Fix | Delete
*/
[344] Fix | Delete
function et_divi_builder_get_minified_scripts( $scripts ) {
[345] Fix | Delete
return array_merge( $scripts, array(
[346] Fix | Delete
'smooth-scroll',
[347] Fix | Delete
) );
[348] Fix | Delete
}
[349] Fix | Delete
add_filter( 'et_builder_get_minified_scripts', 'et_divi_builder_get_minified_scripts' );
[350] Fix | Delete
[351] Fix | Delete
function et_add_mobile_navigation(){
[352] Fix | Delete
if ( is_customize_preview() || ( 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) ) {
[353] Fix | Delete
printf(
[354] Fix | Delete
'<div id="et_mobile_nav_menu">
[355] Fix | Delete
<div class="mobile_nav closed">
[356] Fix | Delete
<span class="select_page">%1$s</span>
[357] Fix | Delete
<span class="mobile_menu_bar mobile_menu_bar_toggle"></span>
[358] Fix | Delete
</div>
[359] Fix | Delete
</div>',
[360] Fix | Delete
esc_html__( 'Select Page', 'Divi' )
[361] Fix | Delete
);
[362] Fix | Delete
}
[363] Fix | Delete
}
[364] Fix | Delete
add_action( 'et_header_top', 'et_add_mobile_navigation' );
[365] Fix | Delete
[366] Fix | Delete
function et_add_viewport_meta(){
[367] Fix | Delete
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />';
[368] Fix | Delete
}
[369] Fix | Delete
add_action( 'wp_head', 'et_add_viewport_meta' );
[370] Fix | Delete
[371] Fix | Delete
function et_remove_additional_stylesheet( $stylesheet ){
[372] Fix | Delete
global $default_colorscheme;
[373] Fix | Delete
return $default_colorscheme;
[374] Fix | Delete
}
[375] Fix | Delete
add_filter( 'et_get_additional_color_scheme', 'et_remove_additional_stylesheet' );
[376] Fix | Delete
[377] Fix | Delete
if ( ! function_exists( 'et_list_pings' ) ) :
[378] Fix | Delete
function et_list_pings($comment, $args, $depth) {
[379] Fix | Delete
$GLOBALS['comment'] = $comment; ?>
[380] Fix | Delete
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
[381] Fix | Delete
<?php }
[382] Fix | Delete
endif;
[383] Fix | Delete
[384] Fix | Delete
if ( ! function_exists( 'et_get_theme_version' ) ) :
[385] Fix | Delete
function et_get_theme_version() {
[386] Fix | Delete
$theme_info = wp_get_theme();
[387] Fix | Delete
[388] Fix | Delete
if ( is_child_theme() ) {
[389] Fix | Delete
$theme_info = wp_get_theme( $theme_info->parent_theme );
[390] Fix | Delete
}
[391] Fix | Delete
[392] Fix | Delete
$theme_version = $theme_info->display( 'Version' );
[393] Fix | Delete
[394] Fix | Delete
return $theme_version;
[395] Fix | Delete
}
[396] Fix | Delete
endif;
[397] Fix | Delete
[398] Fix | Delete
function et_add_post_meta_box( $post_type, $post ) {
[399] Fix | Delete
$allowed = et_pb_is_allowed( 'page_options' );
[400] Fix | Delete
$enabled = $post ? et_builder_enabled_for_post( $post->ID ) : et_builder_enabled_for_post_type( $post_type );
[401] Fix | Delete
$enabled = in_array( $post_type, et_builder_get_default_post_types() ) ? true : $enabled;
[402] Fix | Delete
$public = et_builder_is_post_type_public( $post_type );
[403] Fix | Delete
[404] Fix | Delete
if ( $allowed && $enabled && $public ) {
[405] Fix | Delete
add_meta_box( 'et_settings_meta_box', esc_html__( 'Divi Page Settings', 'Divi' ), 'et_single_settings_meta_box', $post_type, 'side', 'high' );
[406] Fix | Delete
}
[407] Fix | Delete
}
[408] Fix | Delete
add_action( 'add_meta_boxes', 'et_add_post_meta_box', 10, 2 );
[409] Fix | Delete
[410] Fix | Delete
if ( ! function_exists( 'et_pb_portfolio_meta_box' ) ) :
[411] Fix | Delete
function et_pb_portfolio_meta_box() { ?>
[412] Fix | Delete
<div class="et_project_meta">
[413] Fix | Delete
<strong class="et_project_meta_title"><?php echo esc_html__( 'Skills', 'Divi' ); ?></strong>
[414] Fix | Delete
<p><?php echo get_the_term_list( get_the_ID(), 'project_tag', '', ', ' ); ?></p>
[415] Fix | Delete
[416] Fix | Delete
<strong class="et_project_meta_title"><?php echo esc_html__( 'Posted on', 'Divi' ); ?></strong>
[417] Fix | Delete
<p><?php echo get_the_date(); ?></p>
[418] Fix | Delete
</div>
[419] Fix | Delete
<?php }
[420] Fix | Delete
endif;
[421] Fix | Delete
[422] Fix | Delete
if ( ! function_exists( 'et_single_settings_meta_box' ) ) :
[423] Fix | Delete
function et_single_settings_meta_box( $post ) {
[424] Fix | Delete
$post_id = get_the_ID();
[425] Fix | Delete
[426] Fix | Delete
wp_nonce_field( basename( __FILE__ ), 'et_settings_nonce' );
[427] Fix | Delete
[428] Fix | Delete
$page_layout = get_post_meta( $post_id, '_et_pb_page_layout', true );
[429] Fix | Delete
[430] Fix | Delete
if ( 'product' === $post->post_type && empty( $page_layout ) ) {
[431] Fix | Delete
$page_layout = et_get_option( 'et_pb_woocommerce_product_layout' );
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
$side_nav = get_post_meta( $post_id, '_et_pb_side_nav', true );
[435] Fix | Delete
[436] Fix | Delete
$project_nav = get_post_meta( $post_id, '_et_pb_project_nav', true );
[437] Fix | Delete
[438] Fix | Delete
$post_hide_nav = get_post_meta( $post_id, '_et_pb_post_hide_nav', true );
[439] Fix | Delete
$post_hide_nav = $post_hide_nav && 'off' === $post_hide_nav ? 'default' : $post_hide_nav;
[440] Fix | Delete
[441] Fix | Delete
$show_title = get_post_meta( $post_id, '_et_pb_show_title', true );
[442] Fix | Delete
[443] Fix | Delete
$is_builder_active = 'on' === get_post_meta( $post_id, '_et_pb_use_builder', true );
[444] Fix | Delete
[445] Fix | Delete
if ( is_rtl() ) {
[446] Fix | Delete
$page_layouts = array(
[447] Fix | Delete
'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
[448] Fix | Delete
'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
[449] Fix | Delete
'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
[450] Fix | Delete
);
[451] Fix | Delete
} else {
[452] Fix | Delete
$page_layouts = array(
[453] Fix | Delete
'et_right_sidebar' => esc_html__( 'Right Sidebar', 'Divi' ),
[454] Fix | Delete
'et_left_sidebar' => esc_html__( 'Left Sidebar', 'Divi' ),
[455] Fix | Delete
'et_no_sidebar' => esc_html__( 'No Sidebar', 'Divi' ),
[456] Fix | Delete
);
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
// Fullwidth option available for default post types only. Not available for custom post types.
[460] Fix | Delete
if ( ! et_builder_is_post_type_custom( $post->post_type ) || 'product' === $post->post_type && $is_builder_active ) {
[461] Fix | Delete
$page_layouts['et_full_width_page'] = esc_html__( 'Fullwidth', 'Divi' );
[462] Fix | Delete
}
[463] Fix | Delete
[464] Fix | Delete
if ( 'et_full_width_page' === $page_layout && ( ! isset( $page_layouts['et_full_width_page'] ) || ! $is_builder_active ) ) {
[465] Fix | Delete
$page_layout = 'et_no_sidebar';
[466] Fix | Delete
}
[467] Fix | Delete
[468] Fix | Delete
$layouts = array(
[469] Fix | Delete
'light' => esc_html__( 'Light', 'Divi' ),
[470] Fix | Delete
'dark' => esc_html__( 'Dark', 'Divi' ),
[471] Fix | Delete
);
[472] Fix | Delete
$post_bg_color = ( $bg_color = get_post_meta( $post_id, '_et_post_bg_color', true ) ) && '' !== $bg_color
[473] Fix | Delete
? $bg_color
[474] Fix | Delete
: '#ffffff';
[475] Fix | Delete
$post_use_bg_color = get_post_meta( $post_id, '_et_post_use_bg_color', true )
[476] Fix | Delete
? true
[477] Fix | Delete
: false;
[478] Fix | Delete
$post_bg_layout = ( $layout = get_post_meta( $post_id, '_et_post_bg_layout', true ) ) && '' !== $layout
[479] Fix | Delete
? $layout
[480] Fix | Delete
: 'light';
[481] Fix | Delete
[482] Fix | Delete
$tb_layouts = et_theme_builder_get_template_layouts( ET_Theme_Builder_Request::from_post( $post_id ) );
[483] Fix | Delete
$container = array( 'et_pb_page_settings_container' );
[484] Fix | Delete
[485] Fix | Delete
if ( ! empty( $tb_layouts ) ) {
[486] Fix | Delete
$container[] = 'et_pb_page_settings_container--theme-builder';
[487] Fix | Delete
[488] Fix | Delete
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE ]['override'] ) {
[489] Fix | Delete
$container[] = 'et_pb_page_settings_container--tb-has-header';
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ]['override'] ) {
[493] Fix | Delete
$container[] = 'et_pb_page_settings_container--tb-has-body';
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
if ( ! empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE ]['override'] ) {
[497] Fix | Delete
$container[] = 'et_pb_page_settings_container--tb-has-footer';
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function