Ejemplo n.º 1
0
function et_divi_customize_register($wp_customize)
{
    $google_fonts = et_get_google_fonts();
    $font_choices = array();
    $font_choices['none'] = 'Default Theme Font';
    foreach ($google_fonts as $google_font_name => $google_font_properties) {
        $font_choices[$google_font_name] = $google_font_name;
    }
    $wp_customize->remove_section('title_tagline');
    $wp_customize->add_section('et_divi_settings', array('title' => __('Theme Settings', 'Divi'), 'priority' => 40));
    $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Divi'), 'priority' => 50));
    $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Divi'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Divi')));
    $wp_customize->add_setting('et_divi[link_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[link_color]', array('label' => __('Link Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[link_color]')));
    $wp_customize->add_setting('et_divi[font_color]', array('default' => '#666666', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[font_color]', array('label' => __('Main Font Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[font_color]')));
    $wp_customize->add_setting('et_divi[accent_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[accent_color]', array('label' => __('Accent Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[accent_color]')));
    $wp_customize->add_setting('et_divi[footer_bg]', array('default' => '#222222', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[footer_bg]', array('label' => __('Footer Background Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[footer_bg]')));
    $wp_customize->add_setting('et_divi[menu_link]', array('default' => '#666666', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link]', array('label' => __('Menu Links Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link]')));
    $wp_customize->add_setting('et_divi[menu_link_active]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link_active]', array('label' => __('Active Menu Link Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link_active]')));
    $wp_customize->add_setting('et_divi[boxed_layout]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[boxed_layout]', array('label' => __('Boxed Layout', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $wp_customize->add_setting('et_divi[cover_background]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[cover_background]', array('label' => __('Stretch Background Image', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $wp_customize->add_setting('et_divi[vertical_nav]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[vertical_nav]', array('label' => __('Vertical Navigation', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 20));
    $wp_customize->add_setting('et_divi[show_header_social_icons]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[show_header_social_icons]', array('label' => __('Show Social Icons in Header', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 30));
    $wp_customize->add_setting('et_divi[show_footer_social_icons]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[show_footer_social_icons]', array('label' => __('Show Social Icons in Footer', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 40));
    $wp_customize->add_setting('et_divi[show_search_icon]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[show_search_icon]', array('label' => __('Show Search Icon', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 50));
    $wp_customize->add_setting('et_divi[header_style]', array('default' => 'left', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[header_style]', array('label' => __('Header Style', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => array('left' => __('Default', 'Divi'), 'centered' => __('Centered', 'Divi')), 'priority' => 55));
    $wp_customize->add_setting('et_divi[phone_number]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[phone_number]', array('label' => __('Phone Number', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 60));
    $wp_customize->add_setting('et_divi[header_email]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[header_email]', array('label' => __('Email', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 70));
    $wp_customize->add_setting('et_divi[primary_nav_bg]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[primary_nav_bg]', array('label' => __('Primary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[primary_nav_bg]', 'priority' => 80)));
    $wp_customize->add_setting('et_divi[primary_nav_text_color]', array('default' => 'dark', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[primary_nav_text_color]', array('label' => __('Primary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => array('dark' => __('Dark', 'Divi'), 'light' => __('Light', 'Divi')), 'priority' => 90));
    $wp_customize->add_setting('et_divi[secondary_nav_bg]', array('default' => et_get_option('accent_color', '#2EA3F2'), 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[secondary_nav_bg]', array('label' => __('Secondary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[secondary_nav_bg]', 'priority' => 100)));
    $wp_customize->add_setting('et_divi[secondary_nav_text_color]', array('default' => 'light', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[secondary_nav_text_color]', array('label' => __('Secondary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => array('dark' => __('Dark', 'Divi'), 'light' => __('Light', 'Divi')), 'priority' => 110));
    $wp_customize->add_setting('et_divi[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[heading_font]', array('label' => __('Header Font', 'Divi'), 'section' => 'et_google_fonts', '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'));
    $wp_customize->add_control('et_divi[body_font]', array('label' => __('Body Font', 'Divi'), 'section' => 'et_google_fonts', 'settings' => 'et_divi[body_font]', 'type' => 'select', 'choices' => $font_choices));
    $wp_customize->add_setting('et_divi[color_schemes]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_divi[color_schemes]', array('label' => __('Color Schemes', 'Divi'), 'section' => 'et_color_schemes', 'settings' => 'et_divi[color_schemes]', 'type' => 'select', 'choices' => array('none' => __('Default', 'Divi'), 'green' => __('Green', 'Divi'), 'orange' => __('Orange', 'Divi'), 'pink' => __('Pink', 'Divi'), 'red' => __('Red', 'Divi'))));
}
Ejemplo n.º 2
0
 /**
  * Enqueues Google Fonts
  *
  */
 function et_gf_enqueue_fonts($et_gf_font_names)
 {
     global $shortname;
     if (!is_array($et_gf_font_names) || empty($et_gf_font_names)) {
         return;
     }
     $google_fonts = et_get_google_fonts();
     $protocol = is_ssl() ? 'https' : 'http';
     foreach ($et_gf_font_names as $et_gf_font_name) {
         $google_font_character_set = $google_fonts[$et_gf_font_name]['character_set'];
         // By default, only latin and latin-ext subsets are loaded, all available subsets can be enabled in ePanel
         if ('false' == et_get_option("{$shortname}_gf_enable_all_character_sets", 'false')) {
             $latin_ext = '';
             if (false !== strpos($google_fonts[$et_gf_font_name]['character_set'], 'latin-ext')) {
                 $latin_ext = ',latin-ext';
             }
             $google_font_character_set = "latin{$latin_ext}";
         }
         $query_args = array('family' => sprintf('%s:%s', str_replace(' ', '+', $et_gf_font_name), apply_filters('et_gf_set_styles', $google_fonts[$et_gf_font_name]['styles'], $et_gf_font_name)), 'subset' => apply_filters('et_gf_set_character_set', $google_font_character_set, $et_gf_font_name));
         $et_gf_font_name_slug = strtolower(str_replace(' ', '-', $et_gf_font_name));
         wp_enqueue_style('et-gf-' . $et_gf_font_name_slug, esc_url(add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css")), array(), null);
     }
 }
Ejemplo n.º 3
0
 function et_dailyjournal_customize_register($wp_customize)
 {
     $google_fonts = et_get_google_fonts();
     $font_choices = array();
     $font_choices['none'] = 'Default Theme Font';
     foreach ($google_fonts as $google_font_name => $google_font_properties) {
         $font_choices[$google_font_name] = $google_font_name;
     }
     $wp_customize->remove_section('title_tagline');
     $wp_customize->remove_section('background_image');
     $wp_customize->remove_section('colors');
     $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'DailyJournal'), 'priority' => 50));
     $wp_customize->add_setting('dailyjournal_heading_font', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('dailyjournal_heading_font', array('label' => __('Header Font', 'DailyJournal'), 'section' => 'et_google_fonts', 'settings' => 'dailyjournal_heading_font', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('dailyjournal_body_font', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('dailyjournal_body_font', array('label' => __('Body Font', 'DailyJournal'), 'section' => 'et_google_fonts', 'settings' => 'dailyjournal_body_font', 'type' => 'select', 'choices' => $font_choices));
 }
Ejemplo n.º 4
0
function et_vertex_customize_register($wp_customize)
{
    $google_fonts = et_get_google_fonts();
    $font_choices = array();
    $font_choices['none'] = 'Default Theme Font';
    foreach ($google_fonts as $google_font_name => $google_font_properties) {
        $font_choices[$google_font_name] = $google_font_name;
    }
    $wp_customize->remove_section('title_tagline');
    $wp_customize->remove_section('background_image');
    $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Vertex'), 'priority' => 50));
    $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Vertex'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Vertex')));
    $wp_customize->add_setting('et_vertex[link_color]', array('default' => '#4bb6f5', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[link_color]', array('label' => __('Link Color', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[link_color]')));
    $wp_customize->add_setting('et_vertex[font_color]', array('default' => '#959494', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[font_color]', array('label' => __('Main Font Color', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[font_color]')));
    $wp_customize->add_setting('et_vertex[accent_color_1]', array('default' => '#25383b', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[accent_color_1]', array('label' => __('Accent Color #1', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[accent_color_1]')));
    $wp_customize->add_setting('et_vertex[accent_color_2]', array('default' => '#c24c4c', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[accent_color_2]', array('label' => __('Accent Color #2', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[accent_color_2]')));
    $wp_customize->add_setting('et_vertex[menu_link]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[menu_link]', array('label' => __('Menu Links Color', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[menu_link]')));
    $wp_customize->add_setting('et_vertex[menu_link_active]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_vertex[menu_link_active]', array('label' => __('Active Menu Link Color', 'Vertex'), 'section' => 'colors', 'settings' => 'et_vertex[menu_link_active]')));
    $wp_customize->add_setting('et_vertex[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
    $wp_customize->add_control('et_vertex[heading_font]', array('label' => __('Header Font', 'Vertex'), 'section' => 'et_google_fonts', 'settings' => 'et_vertex[heading_font]', 'type' => 'select', 'choices' => $font_choices));
    $wp_customize->add_setting('et_vertex[body_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
    $wp_customize->add_control('et_vertex[body_font]', array('label' => __('Body Font', 'Vertex'), 'section' => 'et_google_fonts', 'settings' => 'et_vertex[body_font]', 'type' => 'select', 'choices' => $font_choices));
    $wp_customize->add_setting('et_vertex[color_schemes]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
    $wp_customize->add_control('et_vertex[color_schemes]', array('label' => __('Color Schemes', 'Vertex'), 'section' => 'et_color_schemes', 'settings' => 'et_vertex[color_schemes]', 'type' => 'select', 'choices' => array('none' => __('Default', 'Vertex'), 'blue' => __('Blue', 'Vertex'), 'green' => __('Green', 'Vertex'), 'purple' => __('Purple', 'Vertex'), 'red' => __('Red', 'Vertex'))));
}
Ejemplo n.º 5
0
 function et_fusion_customize_register($wp_customize)
 {
     $google_fonts = et_get_google_fonts();
     $font_choices = array();
     $font_choices['none'] = 'Default Theme Font';
     foreach ($google_fonts as $google_font_name => $google_font_properties) {
         $font_choices[$google_font_name] = $google_font_name;
     }
     $wp_customize->remove_section('title_tagline');
     $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Fusion'), 'priority' => 50));
     $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Fusion'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Fusion')));
     $wp_customize->add_setting('et_fusion[highlight_color]', array('default' => '#c3e54b', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_fusion[highlight_color]', array('label' => __('Highlight Color', 'Fusion'), 'section' => 'colors', 'settings' => 'et_fusion[highlight_color]')));
     $wp_customize->add_setting('et_fusion[link_color]', array('default' => '#FFA300', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_fusion[link_color]', array('label' => __('Link Color', 'Fusion'), 'section' => 'colors', 'settings' => 'et_fusion[link_color]')));
     $wp_customize->add_setting('et_fusion[font_color]', array('default' => '#454545', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_fusion[font_color]', array('label' => __('Main Font Color', 'Fusion'), 'section' => 'colors', 'settings' => 'et_fusion[font_color]')));
     $wp_customize->add_setting('et_fusion[headings_color]', array('default' => '#454545', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_fusion[headings_color]', array('label' => __('Headings Color', 'Fusion'), 'section' => 'colors', 'settings' => 'et_fusion[headings_color]')));
     $wp_customize->add_setting('et_fusion[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('et_fusion[heading_font]', array('label' => __('Header Font', 'Fusion'), 'section' => 'et_google_fonts', 'settings' => 'et_fusion[heading_font]', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('et_fusion[body_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('et_fusion[body_font]', array('label' => __('Body Font', 'Fusion'), 'section' => 'et_google_fonts', 'settings' => 'et_fusion[body_font]', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('et_fusion[color_schemes]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control('et_fusion[color_schemes]', array('label' => __('Color Schemes', 'Fusion'), 'section' => 'et_color_schemes', 'settings' => 'et_fusion[color_schemes]', 'type' => 'select', 'choices' => array('none' => __('Default', 'Fusion'), 'blue' => __('Blue', 'Fusion'), 'green' => __('Green', 'Fusion'), 'purple' => __('Purple', 'Fusion'), 'red' => __('Red', 'Fusion'))));
 }
Ejemplo n.º 6
0
/**
 * Sanitize font choice
 * @param string
 * @return string|bool
 */
function et_sanitize_font_choices($choosen)
{
    return et_sanitize_key_based_option($choosen, et_get_google_fonts());
}
Ejemplo n.º 7
0
 function et_harmony_customize_register($wp_customize)
 {
     $google_fonts = et_get_google_fonts();
     $font_choices = array();
     $font_choices['none'] = 'Default Theme Font';
     foreach ($google_fonts as $google_font_name => $google_font_properties) {
         $font_choices[$google_font_name] = $google_font_name;
     }
     $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Harmony'), 'priority' => 50));
     $wp_customize->add_setting('et_harmony[link_color]', array('default' => '#FFA300', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_harmony[link_color]', array('label' => __('Link Color', 'Harmony'), 'section' => 'colors', 'settings' => 'et_harmony[link_color]')));
     $wp_customize->add_setting('et_harmony[font_color]', array('default' => '#3D5054', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_harmony[font_color]', array('label' => __('Main Font Color', 'Harmony'), 'section' => 'colors', 'settings' => 'et_harmony[font_color]')));
     $wp_customize->add_setting('et_harmony[logo_color]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_harmony[logo_color]', array('label' => __('Logo Color', 'Harmony'), 'section' => 'colors', 'settings' => 'et_harmony[logo_color]')));
     $wp_customize->add_setting('et_harmony[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('et_harmony[heading_font]', array('label' => __('Header Font', 'Harmony'), 'section' => 'et_google_fonts', 'settings' => 'et_harmony[heading_font]', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('et_harmony[body_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options'));
     $wp_customize->add_control('et_harmony[body_font]', array('label' => __('Body Font', 'Harmony'), 'section' => 'et_google_fonts', 'settings' => 'et_harmony[body_font]', 'type' => 'select', 'choices' => $font_choices));
 }
Ejemplo n.º 8
0
 function et_foxy_customize_register($wp_customize)
 {
     $google_fonts = et_get_google_fonts();
     $font_choices = array();
     $font_choices['none'] = 'Default Theme Font';
     foreach ($google_fonts as $google_font_name => $google_font_properties) {
         $font_choices[$google_font_name] = $google_font_name;
     }
     $wp_customize->remove_section('title_tagline');
     $wp_customize->remove_section('background_image');
     $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Foxy'), 'priority' => 50));
     $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Foxy'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Foxy')));
     $wp_customize->add_setting('et_foxy[link_color]', array('default' => '#4bb6f5', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[link_color]', array('label' => __('Link Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[link_color]')));
     $wp_customize->add_setting('et_foxy[font_color]', array('default' => '#878787', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[font_color]', array('label' => __('Main Font Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[font_color]')));
     $wp_customize->add_setting('et_foxy[slider_bg]', array('default' => '#f7a13c', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[slider_bg]', array('label' => __('Slider Background Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[slider_bg]')));
     $wp_customize->add_setting('et_foxy[slider_shadow]', array('default' => '#bd3905', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[slider_shadow]', array('label' => __('Slider Shadow Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[slider_shadow]')));
     $wp_customize->add_setting('et_foxy[button_bg]', array('default' => '#ff8a1d', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[button_bg]', array('label' => __('Button / Tab Background Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[button_bg]')));
     $wp_customize->add_setting('et_foxy[button_shadow]', array('default' => '#d9531f', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[button_shadow]', array('label' => __('Button / Tab Shadow Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[button_shadow]')));
     $wp_customize->add_setting('et_foxy[widget_highlight]', array('default' => '#ed6f1d', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
     $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_foxy[widget_highlight]', array('label' => __('Widget Hightlight Color / Progress Bar Color', 'Foxy'), 'section' => 'colors', 'settings' => 'et_foxy[widget_highlight]')));
     $wp_customize->add_setting('et_foxy[heading_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'et_sanitize_font_choices'));
     $wp_customize->add_control('et_foxy[heading_font]', array('label' => __('Header Font', 'Foxy'), 'section' => 'et_google_fonts', 'settings' => 'et_foxy[heading_font]', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('et_foxy[body_font]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'et_sanitize_font_choices'));
     $wp_customize->add_control('et_foxy[body_font]', array('label' => __('Body Font', 'Foxy'), 'section' => 'et_google_fonts', 'settings' => 'et_foxy[body_font]', 'type' => 'select', 'choices' => $font_choices));
     $wp_customize->add_setting('et_foxy[color_schemes]', array('default' => 'none', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_sanitize_color_scheme'));
     $wp_customize->add_control('et_foxy[color_schemes]', array('label' => __('Color Schemes', 'Foxy'), 'section' => 'et_color_schemes', 'settings' => 'et_foxy[color_schemes]', 'type' => 'select', 'choices' => et_theme_color_scheme_choices()));
 }
Ejemplo n.º 9
0
function et_divi_customize_register($wp_customize)
{
    $site_domain = get_locale();
    $google_fonts = et_get_google_fonts();
    $et_domain_fonts = array('ru_RU' => 'cyrillic', 'uk' => 'cyrillic', 'bg_BG' => 'cyrillic', 'vi' => 'vietnamese', 'el' => 'greek');
    $et_one_font_languages = et_get_one_font_languages();
    $font_choices = array();
    $font_choices['none'] = 'Default Theme Font';
    foreach ($google_fonts as $google_font_name => $google_font_properties) {
        if ('' !== $site_domain && isset($et_domain_fonts[$site_domain]) && false === strpos($google_font_properties['character_set'], $et_domain_fonts[$site_domain])) {
            continue;
        }
        $font_choices[$google_font_name] = $google_font_name;
    }
    $wp_customize->remove_section('title_tagline');
    $wp_customize->add_section('et_divi_settings', array('title' => __('Theme Settings', 'Divi'), 'priority' => 40));
    $wp_customize->add_section('et_google_fonts', array('title' => __('Fonts', 'Divi'), 'priority' => 50));
    $wp_customize->add_section('et_color_schemes', array('title' => __('Schemes', 'Divi'), 'priority' => 60, 'description' => __('Note: Color settings set above should be applied to the Default color scheme.', 'Divi')));
    $wp_customize->add_setting('et_divi[link_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[link_color]', array('label' => __('Link Color', 'Divi'), 'section' => 'colors', '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' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[font_color]', array('label' => __('Main Font Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[font_color]')));
    $wp_customize->add_setting('et_divi[accent_color]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[accent_color]', array('label' => __('Accent Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[accent_color]')));
    $wp_customize->add_setting('et_divi[footer_bg]', array('default' => '#222222', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[footer_bg]', array('label' => __('Footer Background Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[footer_bg]')));
    $wp_customize->add_setting('et_divi[menu_link]', array('default' => '#666666', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link]', array('label' => __('Menu Links Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link]')));
    $wp_customize->add_setting('et_divi[menu_link_active]', array('default' => '#2EA3F2', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[menu_link_active]', array('label' => __('Active Menu Link Color', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[menu_link_active]')));
    $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' => __('Boxed Layout', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $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' => __('Stretch Background Image', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 10));
    $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' => __('Vertical Navigation', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 20));
    $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' => __('Show Social Icons in Header', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 30));
    $wp_customize->add_setting('et_divi[show_footer_social_icons]', array('default' => 'on', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'wp_validate_boolean'));
    $wp_customize->add_control('et_divi[show_footer_social_icons]', array('label' => __('Show Social Icons in Footer', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 40));
    $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' => __('Show Search Icon', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'checkbox', 'priority' => 50));
    $wp_customize->add_setting('et_divi[header_style]', array('default' => 'left', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_header_styles'));
    $wp_customize->add_control('et_divi[header_style]', array('label' => __('Header Style', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_header_styles(), 'priority' => 55));
    $wp_customize->add_setting('et_divi[phone_number]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('et_divi[phone_number]', array('label' => __('Phone Number', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 60));
    $wp_customize->add_setting('et_divi[header_email]', array('type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_email'));
    $wp_customize->add_control('et_divi[header_email]', array('label' => __('Email', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'text', 'priority' => 70));
    $wp_customize->add_setting('et_divi[primary_nav_bg]', array('default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[primary_nav_bg]', array('label' => __('Primary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[primary_nav_bg]', 'priority' => 80)));
    $wp_customize->add_setting('et_divi[primary_nav_text_color]', array('default' => 'dark', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_dark_light_colors'));
    $wp_customize->add_control('et_divi[primary_nav_text_color]', array('label' => __('Primary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_dark_light_color(), 'priority' => 90));
    $wp_customize->add_setting('et_divi[secondary_nav_bg]', array('default' => et_get_option('accent_color', '#2EA3F2'), 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color'));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'et_divi[secondary_nav_bg]', array('label' => __('Secondary Navigation Background', 'Divi'), 'section' => 'colors', 'settings' => 'et_divi[secondary_nav_bg]', 'priority' => 100)));
    $wp_customize->add_setting('et_divi[secondary_nav_text_color]', array('default' => 'light', 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'et_divi_legacy_sanitize_dark_light_colors'));
    $wp_customize->add_control('et_divi[secondary_nav_text_color]', array('label' => __('Secondary Navigation Text Color', 'Divi'), 'section' => 'et_divi_settings', 'type' => 'select', 'choices' => et_divi_legacy_get_dark_light_color(), 'priority' => 110));
    if (!isset($et_one_font_languages[$site_domain])) {
        $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('et_divi[heading_font]', array('label' => __('Header Font', 'Divi'), 'section' => 'et_google_fonts', '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('et_divi[body_font]', array('label' => __('Body Font', 'Divi'), 'section' => 'et_google_fonts', 'settings' => 'et_divi[body_font]', 'type' => 'select', 'choices' => $font_choices));
    }
    $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' => __('Color Schemes', 'Divi'), 'section' => 'et_color_schemes', 'settings' => 'et_divi[color_schemes]', 'type' => 'select', 'choices' => et_theme_color_scheme_choices()));
}