add_section('amadeo_options', array( 'title' => esc_html__('Amadeo Theme Options', 'amadeo-free'), 'priority' => 35, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_setting('custom_style_active', array( 'default' => 0, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_custom_style_active', array( 'type' => 'checkbox', 'label' => esc_html__('Enable custom colors', 'amadeo-free'), 'section' => 'colors', 'settings' => 'custom_style_active' ) ); $wp_customize->add_setting('color_1', array( 'default' => '#6379a8', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'amadeo_color_1', array( 'label' => esc_html__('Primary color', 'amadeo-free'), 'section' => 'colors', 'settings' => 'color_1', 'priority' => 10, ) )); $wp_customize->add_setting('color_2', array( 'default' => '#5b5b5b', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'amadeo_color_2', array( 'label' => esc_html__('Secondary color', 'amadeo-free'), 'section' => 'colors', 'settings' => 'color_2', ) )); $wp_customize->add_setting('color_3', array( 'default' => '#fff', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'amadeo_color_3', array( 'label' => esc_html__('Primary font color', 'amadeo-free'), 'section' => 'colors', 'settings' => 'color_3', ) )); $wp_customize->add_setting('color_4', array( 'default' => '#fff', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'amadeo_color_4', array( 'label' => esc_html__('Secondary font color', 'amadeo-free'), 'section' => 'colors', 'settings' => 'color_4', ) )); $wp_customize->add_setting('custom_colors_slider_icons', array( 'default' => 'white', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeSelectColor', ) ); $wp_customize->add_control('amadeo_custom_colors_slider_icons', array( 'label' => esc_html__('Color of icons on slider\'s navigation', 'amadeo-free'), 'section' => 'colors', 'settings' => 'custom_colors_slider_icons', 'type' => 'select', 'choices' => array( 'white' => 'White', 'black' => 'Black', 'yellow' => 'Yellow', ) ) ); $wp_customize->add_setting('custom_colors_under_slider_icons', array( 'default' => 'white', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeSelectColor', ) ); $wp_customize->add_control('amadeo_custom_colors_under_slider_icons', array( 'label' => esc_html__('Color of icons under slide', 'amadeo-free'), 'section' => 'colors', 'settings' => 'custom_colors_under_slider_icons', 'type' => 'select', 'choices' => array( 'white' => 'White', 'black' => 'Black', 'yellow' => 'Yellow', ) ) ); $wp_customize->add_setting('custom_colors_content_icons', array( 'default' => 'white', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeSelectColor', ) ); $wp_customize->add_control('amadeo_custom_colors_content_icons', array( 'label' => esc_html__('Colors of icons in pages content', 'amadeo-free'), 'section' => 'colors', 'settings' => 'custom_colors_content_icons', 'type' => 'select', 'choices' => array( 'white' => 'White', 'black' => 'Black', 'yellow' => 'Yellow', ) ) ); $wp_customize->add_setting('display', array( 'sanitize_callback' =>'sanitize_text_field' ) ); $wp_customize->add_control(new AmadeoCustomizeTextareaControl($wp_customize, 'display', array( 'label' => esc_html__('Display', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'display', ) ) ); $wp_customize->add_setting('amadeo_center_logo_sitename', array( 'default' => 0, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_center_logo_sitename_control', array( 'type' => 'checkbox', 'label' => esc_html__('Logo/Sitename and Menu centered', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'amadeo_center_logo_sitename' ) ); $wp_customize->add_setting('fullwidth_layout', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_fullwidth_layout', array( 'type' => 'checkbox', 'label' => esc_html__('Fullwidth page', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'fullwidth_layout' ) ); $wp_customize->add_setting('display_search', array( 'default' => true, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_display_search', array( 'type' => 'checkbox', 'label' => esc_html__('Show search form on top', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'display_search' ) ); $wp_customize->add_setting('show_megamenu', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_megamenu', array( 'type' => 'checkbox', 'label' => esc_html__('Show megamenu', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_megamenu' ) ); $wp_customize->add_setting('show_slider', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_show_slider', array( 'type' => 'checkbox', 'label' => esc_html__('Show slider', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_slider' ) ); $wp_customize->add_setting('social_under_slider', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_under_slider_widget', array( 'type' => 'checkbox', 'label' => esc_html__('Show social media under slider', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'social_under_slider' ) ); $wp_customize->add_setting('right_sidebar_frontpage', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_right_sidebar_frontpage', array( 'type' => 'checkbox', 'label' => esc_html__('Show right sidebar on front page', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'right_sidebar_frontpage' ) ); $wp_customize->add_setting('right_sidebar_single', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_right_sidebar_single', array( 'type' => 'checkbox', 'label' => esc_html__('Show right sidebar on post/page', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'right_sidebar_single' ) ); $wp_customize->add_setting('right_sidebar_single', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_right_sidebar_single', array( 'type' => 'checkbox', 'label' => esc_html__('Show right sidebar on post/page', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'right_sidebar_single' ) ); $wp_customize->add_setting('right_sidebar_single', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_right_sidebar_single', array( 'type' => 'checkbox', 'label' => esc_html__('Show right sidebar on post/page', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'right_sidebar_single' ) ); $wp_customize->add_setting('footer_bottom_sidebar', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_footer_bottom_sidebar', array( 'type' => 'checkbox', 'label' => esc_html__('Show footer bottom sidebar', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'footer_bottom_sidebar' ) ); $wp_customize->add_setting('show_author', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_show_author', array( 'type' => 'checkbox', 'label' => esc_html__('Show post\'s author', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_author' ) ); $wp_customize->add_setting('show_categories', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_show_categories', array( 'type' => 'checkbox', 'label' => esc_html__('Show post\'s categories', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_categories' ) ); $wp_customize->add_setting('show_tags', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_show_tags', array( 'type' => 'checkbox', 'label' => esc_html__('Show post\'s tags', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_tags' ) ); $contents = wp_remote_get('https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBjMF1vv09f-n1dKlR6RDFZTQAnEzqk_Vg'); $json_fonts = json_decode($contents['body']); foreach($json_fonts->items as $json_font){ $fonts[str_replace(' ', '+', $json_font->family) .':'. implode(',', $json_font->variants)] = $json_font->family; } $wp_customize->add_setting('amadeo_google_font_headings', array( 'default' => 'Oswald:300,400,700', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('amadeo_google_font_headings_control', array( 'type' => 'select', 'choices' => $fonts, 'label' => esc_html__('Headers font', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'amadeo_google_font_headings' ) ); $wp_customize->add_setting('amadeo_google_font_nav', array( 'default' => 'Lato:400,700', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('amadeo_google_font_nav_control', array( 'type' => 'select', 'choices' => $fonts, 'label' => esc_html__('Navigations font', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'amadeo_google_font_nav' ) ); $wp_customize->add_setting('amadeo_google_font_text', array( 'default' => 'Lato:400,700', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('amadeo_google_font_text_control', array( 'type' => 'select', 'choices' => $fonts, 'label' => esc_html__('Text font', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'amadeo_google_font_text' ) ); $wp_customize->add_setting('reload', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_setting('show_tooltips', array( 'default' => 1, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'amadeoSanitizeCheckbox', ) ); $wp_customize->add_control('amadeo_show_tooltips', array( 'type' => 'checkbox', 'label' => esc_html__('Show Boostrap\'s tootlips', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'show_tooltips' ) ); $wp_customize->add_control(new AmadeoCustomizeTextareaControl($wp_customize, 'reload', array( 'label' => esc_html__('May need to reload to see the changes options below.', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'reload' ) ) ); $wp_customize->add_setting('right_widgets_count', array( 'default' => '3', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control('amadeo_right_widgets_count', array( 'type' => 'select', 'label' => esc_html__('Number of widgets in right sidebar', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'right_widgets_count', 'choices' => array( '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5 ), ) ); $wp_customize->add_setting('footer_widgets_count', array( 'default' => '3', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control('amadeo_footer_widgets_count', array( 'type' => 'select', 'label' => esc_html__('Number of columns/widgets in footer', 'amadeo-free'), 'section' => 'amadeo_options', 'settings' => 'footer_widgets_count', 'choices' => array( '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '6' => 6, ), ) ); if(isset($wp_customize->selective_refresh)){ $wp_customize->selective_refresh->add_partial('partial_options', array( 'selector' => 'body', 'settings' => array('fullwidth_layout', 'show_megamenu', 'show_slider', 'social_under_slider', 'right_sidebar_frontpage', 'right_sidebar_single', 'display_search', 'show_tooltips', 'amadeo_center_logo_sitename', 'footer_bottom_sidebar', 'show_author', 'show_categories', 'show_tags'), 'render_callback' => function(){ return true; }, 'container_inclusive' => false, )); $wp_customize->selective_refresh->add_partial('partial_custom_colors_slider_icons', array( 'selector' => '#social-icons-container', 'settings' => array('custom_colors_under_slider_icons'), 'render_callback' => function(){ return true; }, 'container_inclusive' => false, )); $wp_customize->selective_refresh->add_partial('partial_custom_colors', array( 'selector' => '#custom-style-colors', 'settings' => array('color_1','color_2','color_3','color_4', 'custom_colors_slider_icons', 'custom_style_active'), 'render_callback' => function(){ return true; }, 'container_inclusive' => false, )); $wp_customize->selective_refresh->add_partial('partial_amadeo_fonts', array( 'selector' => '#amadeo-custom-css', 'settings' => array('amadeo_google_font_headings', 'amadeo_google_font_nav', 'amadeo_google_font_text'), 'render_callback' => function(){ return true; }, 'container_inclusive' => false, )); } function amadeoSanitizeCheckbox($input){ if ($input == true){ return true; } else{ return false; } } function amadeoSanitizeSelectColor($input){ $valid = array( 'white' => 'White', 'black' => 'Black', 'yellow' => 'Yellow', ); if( array_key_exists($input, $valid)){ return $input; } else { return ''; } } } public static function amadeoHeaderStyle(){ if(is_customize_preview()): ?> 1) ? $darker : 1; list($R16,$G16,$B16) = str_split($rgb,2); $R = sprintf("%02X", floor(hexdec($R16)/$darker)); $G = sprintf("%02X", floor(hexdec($G16)/$darker)); $B = sprintf("%02X", floor(hexdec($B16)/$darker)); return $hash.$R.$G.$B; } } include_once ABSPATH . 'wp-includes/class-wp-customize-control.php'; if(class_exists('WP_Customize_Control')){ class AmadeoCustomizeTextareaControl extends WP_Customize_Control{ public $type = 'label'; public function render_content(){ ?>