function et_divi_customize_register($wp_customize) { $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'); 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')); $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_cookie = ''; /** * Set cookie, * 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_cookie = $_GET[$option_set_name]; $secure = 'https' === parse_url(site_url(), PHP_URL_SCHEME); setcookie($option_set_name, $customizer_option_set_cookie, time() + DAY_IN_SECONDS, COOKIEPATH, null, $secure); } if ('' === $customizer_option_set_cookie && isset($_COOKIE[$option_set_name])) { $customizer_option_set_cookie = $_COOKIE[$option_set_name]; } et_builder_init_global_settings(); if (isset($customizer_option_set_cookie) && 'module' === $customizer_option_set_cookie) { $removed_default_sections = array('nav', 'static_front_page'); foreach ($removed_default_sections as $default_section) { $wp_customize->remove_section($default_section); } $wp_customize->remove_panel('widgets'); et_divi_customizer_module_settings($wp_customize); } else { et_divi_customizer_theme_settings($wp_customize); } }
function et_divi_customize_register($wp_customize) { $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'); 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')); $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(); if (isset($customizer_option_set) && 'module' === $customizer_option_set) { // display wp error screen if module customizer disabled for current user if (!et_pb_is_allowed('module_customizer')) { wp_die(esc_html__("you don't have sufficient permissions to access this page", 'Divi')); } $removed_default_sections = array('nav', 'static_front_page'); foreach ($removed_default_sections as $default_section) { $wp_customize->remove_section($default_section); } et_divi_customizer_module_settings($wp_customize); } else { // display wp error screen if theme customizer disabled for current user if (!et_pb_is_allowed('theme_customizer')) { wp_die(esc_html__("you don't have sufficient permissions to access this page", 'Divi')); } et_divi_customizer_theme_settings($wp_customize); } }
function extra_customize_register($wp_customize) { $wp_customize->remove_section('colors'); $wp_customize->register_control_type('ET_Color_Alpha_Control'); 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')); $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 = ''; // init global settings class to apply default values in customizer properly et_builder_init_global_settings(); /** * 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_extra_customizer_option_set', $customizer_option_set, DAY_IN_SECONDS); } if (empty($customizer_option_set) && ($et_customizer_option_set_value = get_transient('et_extra_customizer_option_set'))) { $customizer_option_set = $et_customizer_option_set_value; } if (isset($customizer_option_set) && 'module' === $customizer_option_set) { // Remove all default sections. foreach ($wp_customize->sections() as $default_section_id => $default_section) { $wp_customize->remove_section($default_section_id); } // Remove all default panels. foreach ($wp_customize->panels() as $default_panel_id => $default_panel) { $wp_customize->remove_panel($default_panel_id); } // Remove the nav menus assets which WP shouldn't include if the nav_menus panel is removed. remove_action('customize_controls_enqueue_scripts', array($wp_customize->nav_menus, 'enqueue_scripts')); remove_action('customize_controls_print_footer_scripts', array($wp_customize->nav_menus, 'available_items_template')); $options = extra_customizer_settings('modules'); } else { $options = extra_customizer_settings(); } foreach ($options as $_panel => $panel_options) { $panel = ''; if (count($panel_options['sections']) > 1) { $panel = 'extra_' . $_panel; $wp_customize->add_panel($panel, array('title' => $panel_options['title'], 'priority' => $panel_options['priority'])); } foreach ($panel_options['sections'] as $section => $section_options) { $section_settings = !empty($section_options['settings']) ? $section_options['settings'] : array(); unset($section_options['settings']); if (!empty($panel)) { $section_settings = apply_filters('extra_customizer_register_' . $_panel . '_' . $section . '_settings', $section_settings); $section = 'et_extra_' . $_panel . '_' . $section . '_settings'; } else { $section_settings = apply_filters('extra_customizer_register_' . $section . '_settings', $section_settings); $section = 'et_extra_' . $section . '_settings'; } $section_settings = apply_filters('extra_customizer_register_settings', $section_settings, $section, $panel); et_register_customizer_section($wp_customize, $section_settings, $section, $section_options, $panel); } } }