choices)) { return; } $name = '_customize-radio-' . $this->id; ?> label); ?> description)) : ?> description); ?>
. 'priority' => 160, // Mixed with top-level-section hierarchy. )); $wp_customize->add_panel('panel-settings', array( 'title' => __('Beautymatters Theme Options', 'beautymatters'), 'description' => __('You can configure your Theme to fit your needs', 'beautymatters'), // Include html tags such as
. 'priority' => 160, // Mixed with top-level-section hierarchy. )); $wp_customize->add_panel("panel-plugins", array( 'title' => __("BeautyMatters Plugins", 'beautymatters'), 'panel' => 'panel-plugins', )); $wp_customize->add_section("bmatters-layout", array( 'title' => __("Layout", 'beautymatters'), 'panel' => 'panel-settings', )); /** header configuration * */ $wp_customize->add_section('bmatters_design-header', array( 'title' => __('Header', 'beautymatters'), 'priority' => 30, 'description' => __('Add or customize the Header to fit your needs', 'beautymatters'), 'panel' => 'panel-design' )); /** adding color options * */ $mColors [] = array( 'slug' => 'color-body-background', 'default' => '#FFFFFF', 'label' => __('Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-header-background', 'default' => '#FFFFFF', 'label' => __('Header Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-top-header-background', 'default' => '#EFF2F5', 'label' => __('Top Header Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-top-header-text', 'default' => '#777777', 'label' => __('Top Header Text Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-link-default', 'default' => '#004c72', 'label' => __('Default Link Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-link-default-hover', 'default' => '#185472', 'label' => __('Default Link Color (On Hover)', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-link-default-visited', 'default' => '#35b9fc', 'label' => __('Default Link Color (Visited)', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-footer-background', 'default' => '#242424', 'label' => __('Default Footer Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-footer-copyright-background', 'default' => '#212121', 'label' => __('Default Footer Copyright Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-content-background', 'default' => '#ffffff', 'label' => __('Default Content Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-content-text', 'default' => '#000000', 'label' => __('Default Content Text Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-widget-background', 'default' => '', 'label' => __('Default Widget Background Color', 'beautymatters') ); $mColors [] = array( 'slug' => 'color-widget-text', 'default' => '#000000', 'label' => __('Default Widget Text Color', 'beautymatters') ); foreach ($mColors as $mCustomColors) { // SETTINGS $wp_customize->add_setting( $mCustomColors['slug'], array( 'default' => $mCustomColors['default'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'theme_slug_sanitize_hex_color', 'transport' => 'postMessage' ) ); // CONTROLS $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $mCustomColors['slug'], array('label' => $mCustomColors['label'], 'section' => 'colors', 'settings' => $mCustomColors['slug']) ) ); } /** header configuration * */ $wp_customize->add_section('bmatters_design-header', array( 'title' => __('Header', 'beautymatters'), 'priority' => 30, 'description' => __('Add or customize the Header to fit your needs', 'beautymatters'), 'panel' => 'panel-design' )); //enable header title $wp_customize->add_setting('header-title-visible', array('default' => 'on', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('header-title-visible', array( 'label' => __('Do you want to display the Header title? Its recommend if you dont have a Logo', 'beautymatters'), 'section' => 'bmatters_design-header', 'settings' => 'header-title-visible', 'type' => 'radio', 'choices' => array( 'off' => __('no', 'beautymatters'), 'on' => __('yes', 'beautymatters'), ))); $wp_customize->add_setting('header-badge-visible', array('default' => 'on', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('header-badge-visible', array( 'label' => __('Do you want to display the Header badge? You can use it for Booking', 'beautymatters'), 'section' => 'bmatters_design-header', 'settings' => 'header-badge-visible', 'type' => 'radio', 'choices' => array( 'off' => __('no', 'beautymatters'), 'on' => __('yes', 'beautymatters'), ))); $wp_customize->add_setting('header-badge-text', array('default' => 'Book now', 'sanitize_callback' => 'beautymatters_sanitize_text_html')); $wp_customize->add_control('header-badge-text', array( 'label' => __('Text in the header Badge? HTML allowed', 'beautymatters'), 'description' => __('You can set up a link by using Book now', 'beautymatters'), 'section' => 'bmatters_design-header', 'settings' => 'header-badge-text', 'type' => 'text' )); $wp_customize->add_setting('header-top-text-left', array( 'default' => __(' Best Service around WORKING HOURS : MON-SAT (8.00AM - 6.00PM)', 'beautymatters'), 'transport' => 'refresh', 'sanitize_callback' => 'beautymatters_sanitize_text_html')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'header-top-text-left', array( 'label' => __('Top Header Text', 'beautymatters'), 'description' => __('Define a Top Header Text (for example opening hours)', 'beautymatters'), 'section' => 'bmatters_design-header', 'settings' => 'header-top-text-left', 'type' => 'text', 'default' => __(' Best Service around WORKING HOURS : MON-SAT (8.00AM - 6.00PM)', 'beautymatters') ))); //fonts $wp_customize->add_section('bmatters_design-fonts', array( 'title' => __('Fonts', 'beautymatters'), 'priority' => 30, 'description' => __('Add or customize the Fonts and Fontsize', 'beautymatters'), 'panel' => 'panel-design' )); $fontsUtil = new BeautyMatters_Font_Utils(); $gfonts = array(); foreach ($fontsUtil->get_font_list() as $font) { if (isset($font["name"])) { $gfonts[$font["name"]] = $font["name"]; } } $wp_customize->add_setting('design-font-default', array('default' => reset($gfonts), 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('design-font-default', array( 'label' => __('Default Font?', 'beautymatters'), 'settings' => 'design-font-default', 'section' => 'bmatters_design-fonts', 'type' => 'select', 'description' => __('Please Choose the default Font.', 'beautymatters'), 'choices' => $gfonts, )); $wp_customize->add_setting('design-font-header-title', array('default' => reset($gfonts), 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('design-font-header-title', array( 'label' => __('Default Title Font?', 'beautymatters'), 'settings' => 'design-font-header-title', 'section' => 'bmatters_design-fonts', 'type' => 'select', 'description' => __('Please Choose the default Title Font.', 'beautymatters'), 'choices' => $gfonts, )); // footer $wp_customize->add_section('bmatters_design-footer', array( 'title' => __('Footer', 'beautymatters'), 'priority' => 30, 'description' => __('Add or customize the Footer to fit your needs', 'beautymatters'), 'panel' => 'panel-design' )); $wp_customize->add_setting('footer-visible', array('default' => 'on', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('footer-visible', array( 'label' => __('Should the footer be enabled?', 'beautymatters'), 'section' => 'bmatters_design-footer', 'type' => 'radio', 'choices' => array( 'off' => __('no', 'beautymatters'), 'on' => __('yes', 'beautymatters'), ))); $wp_customize->add_setting('footer-fixed', array('default' => 'off', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('footer-fixed', array( 'label' => __('Should the footer be fixed (and follow by scrolling)?.', 'beautymatters'), 'section' => 'bmatters_design-footer', 'type' => 'radio', 'choices' => array( 'off' => __('no', 'beautymatters'), 'on' => __('yes', 'beautymatters'), ))); $wp_customize->add_setting('footer-copyright-text', array('sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control( 'footer-copyright-text', array( 'settings' => 'footer-copyright-text', 'section' => 'bmatters_design-footer', 'type' => 'text', 'label' => __('Footer Copyright Text?', 'beautymatters'), 'description' => __('The Copyright Text will be displayed in at the end of the page.', 'beautymatters') ) ); $wp_customize->add_setting('footer-default-layout', array('default' => '4', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( new Theme_Slug_Custom_Radio_Image_Control( $wp_customize, 'footer-default-layout', array( 'settings' => 'footer-default-layout', 'section' => 'bmatters_design-footer', 'label' => __('Footer Layout', 'beautymatters'), 'description' => __('Select the layout for the footer.', 'beautymatters'), 'choices' => array( '1' => get_template_directory_uri() . '/assets/images/1-col.png', '2' => get_template_directory_uri() . '/assets/images/2-col.png', '3' => get_template_directory_uri() . '/assets/images/3-col.png', '4' => get_template_directory_uri() . '/assets/images/4-col.png' ))) ); // images design $wp_customize->add_section('bmatters_design-images', array( 'title' => __('Images', 'beautymatters'), 'priority' => 30, 'description' => __('Featured Image (size) in Post?', 'beautymatters'), 'panel' => 'panel-design' )); $wp_customize->add_setting('design-featured-image', array('default' => '1', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'design-featured-image', array( 'settings' => 'design-featured-image', 'section' => 'bmatters_design-images', 'type' => 'select', 'label' => __('Featured Image in Post?', 'beautymatters'), 'description' => __('Do you want to enable a featured Image in your Post? Choose a size to enable.', 'beautymatters'), 'choices' => array( 'none' => __('No Featured Image', 'beautymatters'), '1' => __('Thumbnail', 'beautymatters'), '2' => __('Medium', 'beautymatters'), '3' => __('Large', 'beautymatters'), )) ); /** social media integration * */ $wp_customize->add_section('bmatters_social-media-facebook', array( 'title' => __('Facebook Configuration', 'beautymatters'), 'priority' => 30, 'description' => __('Configure and enable Facebook Integration', 'beautymatters'), 'panel' => 'panel-plugins' )); $wp_customize->add_section('bmatters_social-media-header', array( 'title' => __('Social Media Header Settings', 'beautymatters'), 'priority' => 30, 'description' => __('Configure and enable Social Media Icons in Header', 'beautymatters'), 'panel' => 'panel-settings' )); $mSocialMediaUrls = array(); $mSocialMediaUrls [] = array( 'slug' => 'social-media-header-instagram-url', 'default' => '', 'label' => __('Instagram Icon', 'beautymatters'), 'description' => __('Setting this value will enable Instagram Icons in the Header.', 'beautymatters') ); $mSocialMediaUrls [] = array( 'slug' => 'social-media-header-facebook-url', 'default' => '', 'label' => __('Facebook Icon', 'beautymatters'), 'description' => __('Setting this value will enable Facebook Icons in the Header.', 'beautymatters') ); $mSocialMediaUrls [] = array( 'slug' => 'social-media-header-google-plus-url', 'default' => '', 'label' => __('Google Plus Icon', 'beautymatters'), 'description' => __('Setting this value will enable Google Plus Icons in the Header.', 'beautymatters') ); $mSocialMediaUrls [] = array( 'slug' => 'social-media-header-twitter-url', 'default' => '', 'label' => __('Twitter Icon', 'beautymatters'), 'description' => __('Setting this value will enable Twitter Icons in the Header.', 'beautymatters') ); $mSocialMediaUrls [] = array( 'slug' => 'social-media-header-youtube-url', 'default' => '', 'label' => __('Youtube Icon', 'beautymatters'), 'description' => __('Setting this value will enable Youtube Icons in the Header.', 'beautymatters') ); foreach ($mSocialMediaUrls as $mSocialMediaUrl) { // SETTINGS $wp_customize->add_setting( $mSocialMediaUrl['slug'], array( 'default' => $mSocialMediaUrl['default'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw' ) ); // CONTROLS $wp_customize->add_control( $mSocialMediaUrl['slug'], array('label' => $mSocialMediaUrl['label'], 'description' => $mSocialMediaUrl['description'], 'section' => 'bmatters_social-media-header', 'settings' => $mSocialMediaUrl['slug'], 'type' => 'text') ); } $wp_customize->add_setting('social-media-facebook', array('default' => 'off', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_setting('social-media-facebook-page', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( 'social-media-facebook-page', // $args array( 'settings' => 'social-media-facebook-page', 'section' => 'bmatters_social-media-facebook', 'type' => 'text', 'label' => __('URL of your Facebook Page?', 'beautymatters'), 'description' => __('Setting this value will enable Facebook Icons.', 'beautymatters') ) ); //enable breadcrumb $wp_customize->add_setting('design-breadcrumb-enable', array('default' => 'on', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('design-breadcrumb-enable', array( 'label' => __('Do you want to enable Breadcrumbs by default?', 'beautymatters'), 'section' => 'bmatters_design', 'settings' => 'design-breadcrumb-enable', 'type' => 'radio', 'choices' => array( 'off' => __('no', 'beautymatters'), 'on' => __('yes', 'beautymatters'), ))); //layout style $wp_customize->add_setting('default-layout-style', array('default' => 'boxed', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'default-layout-style', array( 'settings' => 'default-layout-style', 'section' => 'bmatters_design', 'type' => 'select', 'label' => __('Website Layout Style', 'beautymatters'), 'description' => __('Choose between a fixed and fullwidth style.', 'beautymatters'), 'choices' => array( 'full-width' => __('Full Width', 'beautymatters'), 'boxed' => __('Boxed', 'beautymatters'), )) ); //sidebar configuration $wp_customize->add_section('bmatters_design-sidebars', array( 'title' => __('Sidebars', 'beautymatters'), 'priority' => 30, 'description' => __('Add or customize the Sidebars.', 'beautymatters'), 'panel' => 'panel-design' )); $wp_customize->add_setting('sidebar-name-box', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_textarea')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'sidebar-name-box', array( 'label' => __('Custom Sidebars (1 per line)', 'beautymatters'), 'section' => 'bmatters_design-sidebars', 'settings' => 'sidebar-name-box', 'description' => __('format is sidebar-name=sidebar-id', 'beautymatters') ))); $wp_customize->add_setting('sidebar-side', array('default' => 'right', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control('sidebar-side', array( 'label' => __('Sidebar Position?', 'beautymatters'), 'section' => 'bmatters_design-sidebars', 'settings' => 'sidebar-side', 'type' => 'radio', 'choices' => array( 'right' => __('right', 'beautymatters'), 'left' => __('left', 'beautymatters'), ))); // category configuration $wp_customize->add_section('bmatters_design-category', array( 'title' => __('Categories', 'beautymatters'), 'priority' => 30, 'description' => __('Modify the Categories.', 'beautymatters'), 'panel' => 'panel-design' )); $wp_customize->add_setting('bmatters_design-category-type', array('default' => 'default', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'bmatters_design-category-type', array( 'settings' => 'bmatters_design-category-type', 'section' => 'bmatters_design-category', 'type' => 'select', 'label' => __('Design Type of Archive/Category?', 'beautymatters'), 'description' => __('Do you want a boxed or a default layout for your category and archives?', 'beautymatters'), 'choices' => array( 'default' => __('Default', 'beautymatters'), 'boxed' => __('Boxed', 'beautymatters'), 'picture-only' => __('Pictures only', 'beautymatters') )) ); $wp_customize->add_setting('bmatters_design-category-rowcount', array('default' => '3', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'bmatters_design-category-rowcount', array( 'settings' => 'bmatters_design-category-rowcount', 'section' => 'bmatters_design-category', 'type' => 'select', 'label' => __('Entrys per Row?', 'beautymatters'), 'description' => __('How many columns for each row? (only Desktop)', 'beautymatters'), 'choices' => array( '1' => __('1 column', 'beautymatters'), '2' => __('2 columns', 'beautymatters'), '3' => __('3 columns', 'beautymatters'), '4' => __('4 columns', 'beautymatters') )) ); /** layout of header * */ $wp_customize->add_setting('layout-header-navbar-position', array('default' => '1', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'layout-header-navbar-position', array( 'settings' => 'layout-header-navbar-position', 'section' => 'bmatters-layout', 'type' => 'select', 'label' => __('Logo Position', 'beautymatters'), 'description' => __('Please choose the Position of the Logo', 'beautymatters'), 'choices' => array( '1' => __('Left (default)', 'beautymatters'), '2' => __('Middle (Pro)', 'beautymatters'), '3' => __('Right', 'beautymatters') )) ); $wp_customize->add_setting('layout-page-layout', array('default' => '1', 'sanitize_callback' => 'beautymatters_sanitize_choices')); $wp_customize->add_control( 'layout-page-layout', array( 'settings' => 'layout-page-layout', 'section' => 'bmatters-layout', 'type' => 'select', 'label' => __('Default Header Layout', 'beautymatters'), 'description' => __('Please choose the default Header Layout', 'beautymatters'), 'choices' => array( '1' => __('Full Width (default)', 'beautymatters'), '2' => __('Boxed', 'beautymatters') )) ); /** add css section * */ $wp_customize->add_section('section-css', array( 'title' => __('CSS Property', 'beautymatters'), 'priority' => 30, 'description' => __('Modify the Stylesheets of the Page and Enable or Disable different Styles.', 'beautymatters'), 'panel' => 'panel-settings' )); $wp_customize->add_setting('css-custom-textarea', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'css-custom-textarea', array( 'label' => __('Custom CSS', 'beautymatters'), 'section' => 'section-css', 'settings' => 'css-custom-textarea', 'type' => 'text', 'description' => __('Add your Custom CSS to Modify the Page Layout', 'beautymatters') ))); /** add custom html section * */ $wp_customize->add_section('section-custom-html', array( 'title' => __('Custom HTML', 'beautymatters'), 'priority' => 30, 'description' => __('Add custom HTML to your Website without changing the template files.', 'beautymatters'), 'panel' => 'panel-settings' )); $wp_customize->add_setting('html-custom-header', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text_html')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'html-custom-header', array( 'label' => __('Header Custom HTML', 'beautymatters'), 'settings' => 'html-custom-header', 'section' => 'section-custom-html', 'type' => 'text', 'description' => __('This can be used to add your own html between the head tag.', 'beautymatters') ))); $wp_customize->add_setting('html-custom-body', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text_html')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'html-custom-body', array( 'label' => __('Body Custom HTML', 'beautymatters'), 'settings' => 'html-custom-body', 'section' => 'section-custom-html', 'type' => 'text', 'description' => __('This can be used to add your own html between the body tag.', 'beautymatters') ))); $wp_customize->add_setting('html-custom-footer', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text_html')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'html-custom-footer', array( 'label' => __('Body Custom Footer', 'beautymatters'), 'settings' => 'html-custom-footer', 'section' => 'section-custom-html', 'type' => 'text', 'description' => __('This can be used to add your own html at the the end of the body tag.', 'beautymatters') ))); /** add ads section * */ $wp_customize->add_section('section-ads', array( 'title' => __('Ads Property', 'beautymatters'), 'priority' => 30, 'description' => __('Add custom Ads to your Website without modify html code.', 'beautymatters'), 'panel' => 'panel-settings' )); $wp_customize->add_setting('ads-below-header-728x90', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'ads-below-header-728x90', array( 'label' => __('Ad below Header (728x90)', 'beautymatters'), 'settings' => 'ads-below-header-728x90', 'section' => 'section-ads', 'type' => 'text', 'description' => __('Ad must be 728x90 and will be displayed below the Header and above the Content.', 'beautymatters') ))); $wp_customize->add_setting('ads-below-header-728x15', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'ads-below-header-728x15', array( 'label' => __('Ad below Header (728x15)', 'beautymatters'), 'settings' => 'ads-below-header-728x15', 'section' => 'section-ads', 'type' => 'text', 'description' => __('Ad must be 728x15 and will be displayed below the Header and above the Content. Enable this OR 728x90', 'beautymatters') ))); $wp_customize->add_setting('ads-below-header-dynamic-size', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'ads-below-header-dynamic-size', array( 'label' => __('Ad below Header (Dynamic Size)', 'beautymatters'), 'settings' => 'ads-below-header-dynamic-size', 'section' => 'section-ads', 'type' => 'text', 'description' => __('Ad can be any size since it uses the existing place. Do not use it with other ads below the Header for best results.', 'beautymatters') ))); $wp_customize->add_setting('ads-start-content-300x250', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'ads-start-content-300x250', array( 'label' => __('Content Ad (300x250)', 'beautymatters'), 'settings' => 'ads-start-content-300x250', 'section' => 'section-ads', 'type' => 'text', 'description' => __('Ad must be 300x250 and will be floated at the beginning of the content.', 'beautymatters') ))); $wp_customize->add_setting('ads-below-content-468x60', array('default' => '', 'sanitize_callback' => 'beautymatters_sanitize_text')); $wp_customize->add_control(new Theme_Customize_Textarea_Control($wp_customize, 'ads-below-content-468x60', array( 'label' => __('Below Content Ad (468x60)', 'beautymatters'), 'settings' => 'ads-below-content-468x60', 'section' => 'section-ads', 'type' => 'text', 'description' => __('Ad must be 468x60 and will be centered at the end of the Content.', 'beautymatters') ))); } function beautymatters_sanitize_text_html($str) { return trim($str); } function beautymatters_sanitize_text($str) { return sanitize_text_field($str); } function beautymatters_sanitize_textarea($text) { return esc_textarea($text); } function beautymatters_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; } } function amazon_enabled_callback($control) { return ($control->manager->get_setting('plugins-amazon-enable')->value() == 'on'); } /** sanitize colors * */ function theme_slug_sanitize_hex_color($color) { if ('' === $color) return ''; // 3 or 6 hex digits, or the empty string. if (preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color)) return $color; return null; } function bmatters_customizer_live_preview() { wp_enqueue_script( 'mytheme-themecustomizer', //Give the script an ID get_template_directory_uri() . '/assets/js/theme-customizer.js', //Point to file array('jquery', 'customize-preview'), //Define dependencies '', //Define a version (optional) true //Put script in footer? ); } add_action('customize_preview_init', 'bmatters_customizer_live_preview'); function theme_slug_customizer_custom_control_css() { ?>