get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->remove_section( 'title_tagline'); $wp_customize->remove_section( 'colors'); $wp_customize->remove_section( 'header_image'); $wp_customize->remove_section( 'static_front_page'); /** * Logo */ $wp_customize->add_section( 'boden_logos' , array( 'title' => esc_html__( 'Logo', 'boden' ), 'description' => esc_html__( 'Put your logo and your favicon.', 'boden' ), )); $wp_customize->add_setting( 'boden_logo_light' , array( 'sanitize_callback' => 'sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'boden_logo_light', array( 'label' => esc_html__('Logo (Light)', 'boden'), 'section' => 'boden_logos', 'settings' => 'boden_logo_light', 'priority' => 1 ))); $wp_customize->add_setting( 'boden_logo_dark' , array( 'sanitize_callback' => 'sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'boden_logo_dark', array( 'label' => esc_html__('Logo (Dark)', 'boden'), 'section' => 'boden_logos', 'settings' => 'boden_logo_dark', 'priority' => 2 ))); $wp_customize->add_setting( 'boden_favicon' , array( 'sanitize_callback' => 'sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'boden_favicon', array( 'label' => esc_html__('Favicon', 'boden'), 'section' => 'boden_logos', 'settings' => 'boden_favicon', 'priority' => 3 ))); $wp_customize->add_setting( 'boden_apple' , array( 'sanitize_callback' => 'sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'boden_apple', array( 'label' => esc_html__('Apple Icon', 'boden'), 'section' => 'boden_logos', 'settings' => 'boden_apple', 'priority' => 4 ))); /** * Colors */ $wp_customize->add_section( 'boden_colors' , array( 'title' => esc_html__( 'Colors', 'boden' ), 'description' => esc_html__( 'Change the theme colors to fit your taste.', 'boden' ), )); $wp_customize->add_setting( 'boden_color_mode', array( 'default' => 'light', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_color_mode', array( 'label' => esc_html__('Theme Color Mode','boden'), 'section' => 'boden_colors', 'type' => 'radio', 'default' => 'light', 'choices' => array( 'dark' => 'Dark', 'light' => 'Light'), 'settings' => 'boden_color_mode', 'priority' => 1 )); /** * Fonts */ $wp_customize->add_section( 'boden_fonts' , array( 'title' => esc_html__( 'Fonts', 'boden' ), 'description' => esc_html__( 'Change the theme font to fit your taste.', 'boden' ), )); $wp_customize->add_setting( 'boden_main_font', array( 'default' => 'default', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_main_font', array( 'label' => esc_html__('Main Font','boden'), 'description' => esc_html__('Change the main font for your website.','boden'), 'section' => 'boden_fonts', 'type' => 'select', 'choices' => boden_fonts_list(), 'settings' => 'boden_main_font', 'priority' => 1 )); /** * Display */ $wp_customize->add_section( 'boden_display' , array( 'title' => esc_html__( 'Display', 'boden' ), 'description' => esc_html__( 'Control the way your website starts.', 'boden' ), )); $wp_customize->add_setting( 'boden_display_loader', array( 'default' => 'true', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_display_loader', array( 'label' => esc_html__('Enable Theme Loader','boden'), 'section' => 'boden_display', 'type' => 'radio', 'choices' => array('true' => 'On','false' => 'Off'), 'settings' => 'boden_display_loader', 'priority' => 1 )); $wp_customize->add_setting( 'boden_display_animated', array( 'default' => 'true', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_display_animated', array( 'label' => esc_html__('Enable Theme Animations','boden'), 'section' => 'boden_display', 'type' => 'radio', 'choices' => array('true' => 'On','false' => 'Off'), 'settings' => 'boden_display_animated', 'priority' => 2 )); /** * Header */ $wp_customize->add_section( 'boden_header' , array( 'title' => esc_html__( 'Header', 'boden' ), 'description' => esc_html__( 'Customize how the header looks and feels.', 'boden' ), )); $wp_customize->add_setting( 'boden_header_menu', array( 'default' => 'full-screen', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_header_menu', array( 'label' => esc_html__('Menu Style','boden'), 'description' => esc_html__('Choose the style you want for the menu.','boden'), 'section' => 'boden_header', 'type' => 'radio', 'choices' => array('full-screen' => 'Full Screen', 'side-menu' => 'Side Menu'), 'settings' => 'boden_header_menu', 'priority' => 1 )); /*$wp_customize->add_setting( 'boden_header_cta', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_header_cta', array( 'label' => esc_html__('Show "Call to Action" Button?','boden'), 'section' => 'boden_header', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_header_cta', 'priority' => 1 )); $wp_customize->add_setting( 'boden_header_cta_text',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('boden_header_cta_text', array( 'label' => esc_html__( '"Call to Action" Button Text', 'boden'), 'section' => 'boden_header', 'settings' => 'boden_header_cta_text', 'type' => 'text', 'priority' => 2 )); $wp_customize->add_setting( 'boden_header_cta_url',array( 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('boden_header_cta_url', array( 'label' => esc_html__( '"Call to Action" Button URL', 'boden'), 'section' => 'boden_header', 'settings' => 'boden_header_cta_url', 'type' => 'text', 'priority' => 3 ));*/ /** * Footer */ $wp_customize->add_section( 'boden_footer' , array( 'title' => esc_html__( 'Footer', 'boden' ), 'description' => esc_html__( 'Put your own copyright text. It goes in the bottom of every page.', 'boden' ), )); $wp_customize->add_setting( 'boden_footer_copyright',array( 'default' => '© 2015 Boden. All Rights Reserved. Made by Limitless Themes.', 'sanitize_callback' => 'wp_kses_post', )); $wp_customize->add_control('boden_footer_copyright', array( 'label' => esc_html__( 'Footer Text', 'boden'), 'section' => 'boden_footer', 'settings' => 'boden_footer_copyright', 'type' => 'text', 'priority' => 1 )); $wp_customize->add_setting( 'boden_footer_social', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_footer_social', array( 'label' => esc_html__('Show Social Links','boden'), 'section' => 'boden_footer', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_footer_social', 'priority' => 2 )); $wp_customize->add_setting( 'boden_footer_back', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_footer_back', array( 'label' => esc_html__('Show "Back to Top" button','boden'), 'section' => 'boden_footer', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_footer_back', 'priority' => 3 )); /** * Call to Action */ $wp_customize->add_section( 'boden_cta' , array( 'title' => esc_html__( 'Call to Action', 'boden' ), )); $wp_customize->add_setting( 'boden_cta_enabled', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_cta_enabled', array( 'label' => esc_html__('Show "Call to Action" Section','boden'), 'description' => esc_html__('Do you want to display the "Call to Action" section above the footer','boden'), 'section' => 'boden_cta', 'type' => 'radio', 'choices' => array('on' => 'Show', 'off' => 'Hide'), 'settings' => 'boden_cta_enabled', 'priority' => 1 )); $wp_customize->add_setting( 'boden_cta_text',array( 'default' => 'Work with us', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('boden_cta_text', array( 'label' => esc_html__('Button Text', 'boden'), 'description' => esc_html__('Insert a text for the button.','boden'), 'section' => 'boden_cta', 'settings' => 'boden_cta_text', 'type' => 'text', 'priority' => 2 )); $wp_customize->add_setting( 'boden_cta_url',array( 'default' => '#', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('boden_cta_url', array( 'label' => esc_html__( 'Button URL', 'boden'), 'description' => esc_html__('Insert a URL link for the button.','boden'), 'section' => 'boden_cta', 'settings' => 'boden_cta_url', 'type' => 'text', 'priority' => 3 )); $wp_customize->add_setting( 'boden_cta_background' , array( 'sanitize_callback' => 'sanitize_url', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'boden_cta_background', array( 'label' => esc_html__('Background Image', 'boden'), 'description' => esc_html__('Upload a background image for the section.','boden'), 'section' => 'boden_cta', 'settings' => 'boden_cta_background', 'priority' => 4 ))); /** * Blog */ $wp_customize->add_section( 'boden_blog' , array( 'title' => esc_html__( 'Blog', 'boden' ), 'description' => esc_html__( 'Control what you want to display for blog page.', 'boden' ), )); $wp_customize->add_setting( 'boden_blog_sidebar', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_blog_sidebar', array( 'label' => esc_html__('Show Sidebar','boden'), 'section' => 'boden_blog', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_blog_sidebar', 'priority' => 1 )); $wp_customize->add_setting( 'boden_blog_cat', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_blog_cat', array( 'label' => esc_html__('Show Post Category','boden'), 'section' => 'boden_blog', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_blog_cat', 'priority' => 2 )); $wp_customize->add_setting( 'boden_blog_date', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_blog_date', array( 'label' => esc_html__('Show Post Date','boden'), 'section' => 'boden_blog', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_blog_date', 'priority' => 3 )); $wp_customize->add_setting( 'boden_blog_tags', array( 'default' => 'off', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_blog_tags', array( 'label' => esc_html__('Show Post Tags','boden'), 'section' => 'boden_blog', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_blog_tags', 'priority' => 4 )); $wp_customize->add_setting( 'boden_blog_number', array( 'default' => '6', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( 'boden_blog_number', array( 'label' => esc_html__('Posts per Page','boden'), 'section' => 'boden_blog', 'type' => 'text', 'settings' => 'boden_blog_number', 'priority' => 5 )); /** * Post */ $wp_customize->add_section( 'boden_post' , array( 'title' => esc_html__( 'Posts', 'boden' ), 'description' => esc_html__( 'Control what you want to display for blog posts.', 'boden' ), )); /*$wp_customize->add_setting( 'boden_post_sidebar', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_post_sidebar', array( 'label' => esc_html__('Show Sidebar','boden'), 'section' => 'boden_post', 'type' => 'radio', 'choices' => array('on' => 'Show','off' => 'Hide'), 'settings' => 'boden_post_sidebar', 'priority' => 1 ));*/ $wp_customize->add_setting( 'boden_post_category', array( 'default' => 'true', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_post_category', array( 'label' => esc_html__('Meta: Show Post Category','boden'), 'section' => 'boden_post', 'type' => 'radio', 'choices' => array('true' => 'Enable','false' => 'Disable'), 'settings' => 'boden_post_category', 'priority' => 2 )); $wp_customize->add_setting( 'boden_post_date', array( 'default' => 'true', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_post_date', array( 'label' => esc_html__('Meta: Show Post Date','boden'), 'section' => 'boden_post', 'type' => 'radio', 'choices' => array('true' => 'Enable','false' => 'Disable'), 'settings' => 'boden_post_date', 'priority' => 3 )); $wp_customize->add_setting( 'boden_post_share', array( 'default' => 'true', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_post_share', array( 'label' => esc_html__('Show Social Sharing Links','boden'), 'section' => 'boden_post', 'type' => 'radio', 'choices' => array('true' => 'Enable','false' => 'Disable'), 'settings' => 'boden_post_share', 'priority' => 4 )); /** * Portfolio Item */ $wp_customize->add_section( 'boden_project' , array( 'title' => esc_html__( 'Portfolio Post Page', 'boden' ), 'description' => esc_html__( 'Control what you want to display for portfolio posts.', 'boden' ), )); $wp_customize->add_setting( 'boden_project_social', array( 'default' => 'on', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_project_social', array( 'label' => esc_html__('Show Social Sharing Buttons?','boden'), 'section' => 'boden_project', 'type' => 'radio', 'choices' => array( 'on' => 'Show', 'off' => 'Hide' ), 'settings' => 'boden_project_social', 'priority' => 1 )); /** * Google Analytics */ $wp_customize->add_section( 'boden_analytics' , array( 'title' => esc_html__( 'Google Analytics', 'boden' ), )); $wp_customize->add_setting( 'boden_analytics_enabled', array( 'default' => 'false', 'sanitize_callback' => 'boden_sanitize_choices', )); $wp_customize->add_control( 'boden_analytics_enabled', array( 'label' => esc_html__('Enable Google Analytics','boden'), 'description' => esc_html__('Do you want to enable Google Analytics on your website?','boden'), 'section' => 'boden_analytics', 'type' => 'radio', 'choices' => array('true' => 'Enable', 'false' => 'Disable'), 'settings' => 'boden_analytics_enabled', 'priority' => 1 )); $wp_customize->add_setting( 'boden_analytics_code',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('boden_analytics_code', array( 'label' => esc_html__('Tracking ID', 'boden'), 'description' => esc_html__('Enter the tracking ID you got on Google Analytics.','boden'), 'section' => 'boden_analytics', 'settings' => 'boden_analytics_code', 'type' => 'text', 'priority' => 2 )); } add_action( 'customize_register', 'boden_customize_register' ); /** * Sanitize Choices. */ function boden_sanitize_choices( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } /** * Convert HEX to RGB. */ function boden_hex2rgb($color, $opacity) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)) return $default; //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if(abs($opacity) > 1) $opacity = 1.0; $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; //Return rgb(a) color string return $output; } ?>