add_setting( 'ct_acool[header_bgcolor]', array(//ct_style_options[header_bgcolor] 'default' => '#ffffff', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_bgcolor_html_id', array( 'label' => __( 'Header Background Color', 'acool' ), 'section' => 'colors', 'settings' => 'ct_acool[header_bgcolor]', ) ) ); $wp_customize->add_setting( 'ct_acool[content_link_color]', array(//ct_style_options[header_bgcolor] 'default' => '#03a325', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'content_link_color_id', array( 'label' => __( 'Content links color', 'acool' ), 'section' => 'colors', 'settings' => 'ct_acool[content_link_color]', ) ) ); $wp_customize->add_setting( 'ct_acool[content_link_hover_color]', array(//ct_style_options[header_bgcolor] 'default' => '#0c8432', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'content_link_hover_color_id', array( 'label' => __( 'Content links hover color', 'acool' ), 'section' => 'colors', 'settings' => 'ct_acool[content_link_hover_color]', ) ) ); $wp_customize->add_setting( 'ct_acool[other_link_color]', array(//ct_style_options[header_bgcolor] 'default' => '#3a3a3a', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'other_link_color_id', array( 'label' => __( 'Other links color', 'acool' ), 'section' => 'colors', 'settings' => 'ct_acool[other_link_color]', ) ) ); $wp_customize->add_setting( 'ct_acool[other_link_hover_color]', array(//ct_style_options[header_bgcolor] 'default' => '#0c8432', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_hex_color', 'transport' => 'postMessage' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'other_link_hover_color_id', array( 'label' => __( 'Other links hover color', 'acool' ), 'section' => 'colors', 'settings' => 'ct_acool[other_link_hover_color]', ) ) ); //Theme Settings section $wp_customize->add_section( 'ct_acool_settings' , array( 'title' => __( 'Theme Settings', 'acool' ), 'priority' => 40, 'description' => '
' . __('1. Documentation for Acool can be found here', 'acool') . '
' . __('2. A full theme demo can be found here', 'acool') . '
', ) ); //Show Search Icon $wp_customize->add_setting( 'ct_acool[show_search_icon]', array( 'default' => 1, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[show_search_icon]', array( 'label' => __( 'Show Search Icon', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Box Header Center $wp_customize->add_setting( 'ct_acool[box_header_center]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[box_header_center]', array( 'label' => __( 'Box Header Center', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Enable Query Loader $wp_customize->add_setting( 'ct_acool[enable_query_loader]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[enable_query_loader]', array( 'label' => __( 'Enable Query Loader', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, 'description' => '' . __('For the following options you need to save and to refresh the display change!', 'acool') . '
', ) ); //Fixed Header $wp_customize->add_setting( 'ct_acool[fixed_header]', array( 'default' => 1, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[fixed_header]', array( 'label' => __( 'Fixed Header', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Header Opacity $wp_customize->add_setting( 'ct_acool[header_opacity]', array( 'default' => 0.4, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_decimal_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[header_opacity]', array( 'label' => __( 'Header Opacity', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'select', 'choices' => array('0.1'=> '0.1','0.2'=> '0.2','0.3'=> '0.3','0.4'=> '0.4','0.5'=> '0.5','0.6'=> '0.6','0.7'=> '0.7','0.8'=> '0.8','0.9'=> '0.9','1'=> '1'), 'priority' => 50, ) ); //show breadcrumb $wp_customize->add_setting( 'ct_acool[show_breadcrumb]', array( 'default' => 1, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[show_breadcrumb]', array( 'label' => __( 'Breadcrumb', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Display Footer Widget Area $wp_customize->add_setting( 'ct_acool[display_footer_widget_area]', array( 'default' => 1, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[display_footer_widget_area]', array( 'label' => __( 'Display Footer Widget Area', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); //Hide Post Meta $wp_customize->add_setting( 'ct_acool[hide_post_meta]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[hide_post_meta]', array( 'label' => __( 'Hide Post Meta', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, 'description'=>__('Hide date, author, category...below blog title.','acool') ) ); //Hide Login menu $wp_customize->add_setting( 'ct_acool[hide_login_menu]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_num', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'ct_acool[hide_login_menu]', array( 'label' => __( 'Hide Login Menu', 'acool' ), 'section' => 'ct_acool_settings', 'type' => 'checkbox', 'priority' => 50, ) ); // Theme Options Panel $wp_customize->add_panel( 'acool_homepage_set', array( 'title' => esc_html__( 'Homepage Set', 'acool' ), 'priority' => 120, 'description' => '' . __('Must enable the Featured Homepage, and set up a Static Front Page, the banner will be displayed!', 'acool') . '
', ) ); /* * HomePage Banner Set */ $wp_customize->add_section('ct_homepage_banner' , array( 'title' => esc_html__('HomePage Banner', 'acool'), 'panel' => 'acool_homepage_set', 'priority' => 120, )); //homepage banner images // ============================= // = Image Upload = // ============================= $wp_customize->add_setting('ct_acool[homepage_banner_img]', array( 'default' => get_stylesheet_directory_uri().'/images/banner1.jpg', 'sanitize_callback' => 'acool_sanitize_url', 'capability' => 'edit_theme_options', 'type' => 'option', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'homepage_banner_img', array( 'label' => __('Homepage Banner Image:', 'acool'), 'section' => 'ct_homepage_banner', 'settings' => 'ct_acool[homepage_banner_img]', ))); // $wp_customize->add_setting( 'ct_acool[homepage_banner_button_url]', array( 'default' => __('#', 'acool'), 'sanitize_callback' => 'acool_sanitize_url', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_banner_button_url]', array( 'label' => __( 'Homepage Banner Button Url:', 'acool' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_acool[homepage_banner_button_url]', 'type' => 'url', ) ); //homepage banner H1 $wp_customize->add_setting( 'ct_acool[homepage_banner_text_h1]', array( 'default' => __('The jQuery slider that just slides.', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_banner_text_h1]', array( 'label' => __( 'Homepage Banner Text H1:', 'acool' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_acool[homepage_banner_text_h1]', 'type' => 'textarea', ) ); //homepage banner text $wp_customize->add_setting( 'ct_acool[homepage_banner_text]', array( 'default' => __('No fancy effects or unnecessary markup.', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_banner_text]', array( 'label' => __( 'Homepage Banner Text:', 'acool' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_acool[homepage_banner_text]', 'type' => 'textarea', ) ); //homepage banner text $wp_customize->add_setting( 'ct_acool[homepage_banner_button_text]', array( 'default' => __('Download', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_banner_button_text]', array( 'label' => __( 'Homepage Banner Button Text:', 'acool' ), 'section' => 'ct_homepage_banner', 'settings' => 'ct_acool[homepage_banner_button_text]', 'type' => 'textarea', ) ); /* * HomePage post_list Set */ $wp_customize->add_section('ct_homepage_post_list' , array( 'title' => esc_html__('HomePage Post List Set', 'acool'), 'panel' => 'acool_homepage_set', 'priority' => 120, )); //homepage Post List H1 $wp_customize->add_setting( 'ct_acool[homepage_post_list_h1]', array( 'default' => __('Blog posts', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_post_list_h1]', array( 'label' => __( 'Homepage Post List Title:', 'acool' ), 'section' => 'ct_homepage_post_list', 'settings' => 'ct_acool[homepage_post_list_h1]', 'type' => 'text', ) ); //homepage Post List text $wp_customize->add_setting( 'ct_acool[homepage_post_list_text]', array( 'default' => __('Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere.', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_post_list_text]', array( 'label' => __( 'Homepage Post List Text:', 'acool' ), 'section' => 'ct_homepage_post_list', 'settings' => 'ct_acool[homepage_post_list_text]', 'type' => 'textarea', ) ); //Homepage Post List Number $wp_customize->add_setting( 'ct_acool[homepage_post_list_num]', array( 'default' => 6, 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option', ) ); $wp_customize->add_control( 'ct_acool[homepage_post_list_num]', array( 'label' => __( 'Homepage Post List Number:', 'acool' ), 'section' => 'ct_homepage_post_list', 'settings' => 'ct_acool[homepage_post_list_num]', 'type' => 'select', 'choices' => array('3' => 3,'6' => 6,'9' => 9,'12' => 12), //'default' => 6, ) ); // $wp_customize->add_setting( 'ct_acool[homepage_blog_url]', array( 'default' => esc_url(home_url('/')).'blog/', 'sanitize_callback' => 'acool_sanitize_url', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_blog_url]', array( 'label' => __( 'Blog Url:', 'acool' ), 'section' => 'ct_homepage_post_list', 'settings' => 'ct_acool[homepage_blog_url]', 'type' => 'url', ) ); function get_categories_select() { $teh_cats = get_categories(); $results; $count = count($teh_cats); for ($i=0; $i < $count; $i++) { if (isset($teh_cats[$i])) $results[$teh_cats[$i]->slug] = $teh_cats[$i]->name; else $count++; } return $results; } $wp_customize->add_setting('ct_acool[post_list_cat]', array( 'default' => 'uncategorized', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'acool_sanitize_textarea', 'transport' => 'postMessage', 'type' => 'option' )); $wp_customize->add_control( 'ct_acool[post_list_cat]', array( 'settings' => 'ct_acool[post_list_cat]', 'label' => __( 'Post List Category:', 'acool' ), 'section' => 'ct_homepage_post_list', 'type' => 'select', 'choices' => get_categories_select() )); /* * HomePage contact_us Set */ $wp_customize->add_section('ct_homepage_contact_us' , array( 'title' => esc_html__('HomePage Contact Us Set', 'acool'), 'panel' => 'acool_homepage_set', 'priority' => 120, )); //homepage Contact Us H1 $wp_customize->add_setting( 'ct_acool[homepage_contact_ust_h1]', array( 'default' => __('Contact Us', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_contact_us_h1]', array( 'label' => __( 'Homepage Contact Us Title:', 'acool' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_acool[homepage_contact_ust_h1]', 'type' => 'text', ) ); //homepage Contact Us text $wp_customize->add_setting( 'ct_acool[homepage_contact_us_text]', array( 'default' => __('Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere.', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_contact_us_text]', array( 'label' => __( 'Homepage Contact Us Text:', 'acool' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_acool[homepage_contact_us_text]', 'type' => 'textarea', ) ); //homepage Contact Us email $wp_customize->add_setting( 'ct_acool[homepage_contact_us_email]', array( 'default' => get_bloginfo( 'admin_email'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[homepage_contact_us_email]', array( 'label' => __( 'Contact Us Email:', 'acool' ), 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_acool[homepage_contact_us_email]', 'type' => 'email', ) ); //homepage Contact Us Google Maps $wp_customize->add_setting( 'ct_acool[google_maps]', array( 'default' => '!1m18!1m12!1m3!1d3058.276857292534!2d-75.2014636841563!3d39.95756237942114!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c6c656420e77d1%3A0x904100f3a0d41015!2s3852+Filbert+St%2C+Philadelphia%2C+PA+19104!5e0!3m2!1sen!2sus!4v1477039414870', 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[google_maps]', array( 'label' => __( 'Google Maps API:', 'acool' ),//https://support.google.com/maps/answer/144361?co=GENIE.Platform%3DDesktop&hl=en 'section' => 'ct_homepage_contact_us', 'settings' => 'ct_acool[google_maps]', 'type' => 'textarea', 'description' => '' . __('Get:', 'acool') . ' https://support.google.com/maps/answer/144361?co=GENIE.Platform%3DDesktop&hl=en
', ) ); /* * footer info add */ $wp_customize->add_section('ct_footer_add_info' , array( 'title' => __('Footer text', 'acool'), 'priority' => 120, )); $wp_customize->add_setting( 'ct_acool[footer_info]', array( 'default' => __('Copyright 2015', 'acool'), 'sanitize_callback' => 'acool_sanitize_textarea', 'capability' => 'edit_theme_options', 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'ct_acool[footer_info]', array( 'section' => 'ct_footer_add_info', 'settings' => 'ct_acool[footer_info]', 'type' => 'textarea', ) ); } add_action( 'customize_register', 'acool_customize_register' ); function acool_sanitize_textarea( $str ) { return wp_kses_post($str); } function acool_sanitize_decimal_num( $value) { if ( ! $value || is_null($value) ) return $value; $value = esc_attr( $value); // clean input return ( 0 < $value ) ? $value : null; } function acool_sanitize_num( $value) { if ( ! $value || is_null($value) ) return $value; $value = esc_attr( $value); // clean input $value = (int) $value; // Force the value into integer type. return ( 0 < $value ) ? $value : null; } function acool_sanitize_hex_color( $color ) { if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) return '#'.$unhashed; return '#'.$color; } function acool_sanitize_url( $value ) { $value = esc_url( $value); return $value; } //real time show function acool_load_scripts(){ global $wp_styles; $template_dir = get_template_directory_uri(); $theme_version = '1.1.0'; wp_enqueue_script( 'acool-customizer', //Give the script an ID get_template_directory_uri().'/includes/customize/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', 'acool_load_scripts' ); //footer.php add