get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'header_image' )->panel = 'santamas_theme_option_panel'; $wp_customize->get_section( 'header_image' )->title = esc_html__('Inner Page Header Banner', 'santamas'); $wp_customize->get_section( 'background_image' )->panel = 'santamas_theme_option_panel'; $wp_customize->get_section( 'static_front_page' )->priority = 1; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'santamas_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'santamas_customize_partial_blogdescription', ) ); } $santamas_pages = get_pages(array('hide_empty' => 0)); foreach ($santamas_pages as $santamas_pages_single) { $santamas_page_choice[$santamas_pages_single->ID] = $santamas_pages_single->post_title; } $santamas_categories = get_categories(array('hide_empty' => 0)); foreach ($santamas_categories as $santamas_category) { $santamas_cat[$santamas_category->term_id] = $santamas_category->cat_name; } /*============THEME OPTION PANEL============*/ $wp_customize->add_panel( 'santamas_theme_option_panel', array( 'title' => esc_html__( 'Theme Options', 'santamas' ), 'priority' => 3 ) ); $wp_customize->add_section( 'santamas_footer_section', array( 'title' => esc_html__( 'Footer Options', 'santamas' ), 'panel' => 'santamas_theme_option_panel' ) ); $wp_customize->add_setting( 'santamas_footer_logo', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'santamas_footer_logo', array( 'settings' => 'santamas_footer_logo', 'section' => 'santamas_footer_section', 'label' => esc_html__( 'Footer Logo ', 'santamas' ), ) ) ); /*============SOCIAL ICONS SECTION============*/ $wp_customize->add_setting( 'santamas_social_facebook', array( 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_facebook', array( 'settings' => 'santamas_social_facebook', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Facebook', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_social_twitter', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_twitter', array( 'settings' => 'santamas_social_twitter', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Twitter', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_social_google_plus', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_google_plus', array( 'settings' => 'santamas_social_google_plus', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Google Plus', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_social_pinterest', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_pinterest', array( 'settings' => 'santamas_social_pinterest', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Pinterest', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_social_youtube', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_youtube', array( 'settings' => 'santamas_social_youtube', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Youtube', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_social_linkedin', array( 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( 'santamas_social_linkedin', array( 'settings' => 'santamas_social_linkedin', 'section' => 'santamas_footer_section', 'type' => 'text', 'label' => esc_html__( 'Linkedin', 'santamas' ) ) ); /*============HOME PAGE PANEL============*/ $wp_customize->add_panel( 'santamas_home_panel', array( 'title' => esc_html__( 'Home Page Sections', 'santamas' ), 'priority' => 2 ) ); $wp_customize->add_section( 'santamas_banner_section', array( 'title' => esc_html__( 'Banner Section', 'santamas' ), 'panel' => 'santamas_home_panel', ) ); $wp_customize->add_setting( 'santamas_banner_image', array( 'sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() . '/images/city.jpg' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'santamas_banner_image', array( 'settings' => 'santamas_banner_image', 'section' => 'santamas_banner_section', 'label' => esc_html__( 'Banner Image ', 'santamas' ), ) ) ); $wp_customize->add_setting( 'santamas_banner_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_title', array( 'settings' => 'santamas_banner_title', 'section' => 'santamas_banner_section', 'type' => 'text', 'label' => esc_html__( 'Caption Title', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_sub_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_sub_title', array( 'settings' => 'santamas_banner_sub_title', 'section' => 'santamas_banner_section', 'type' => 'textarea', 'label' => esc_html__( 'Caption SubTitle', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_text1', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_text1', array( 'settings' => 'santamas_banner_text1', 'section' => 'santamas_banner_section', 'type' => 'text', 'label' => esc_html__( 'Button Text', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_link1', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_link1', array( 'settings' => 'santamas_banner_link1', 'section' => 'santamas_banner_section', 'type' => 'text', 'label' => esc_html__( 'Button Link', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_text2', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_text2', array( 'settings' => 'santamas_banner_text2', 'section' => 'santamas_banner_section', 'type' => 'text', 'label' => esc_html__( 'Button Text', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_link2', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_banner_link2', array( 'settings' => 'santamas_banner_link2', 'section' => 'santamas_banner_section', 'type' => 'text', 'label' => esc_html__( 'Button Link', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_banner_effect', array( 'default' => 'none', 'sanitize_callback' => 'santamas_sanitize_choices' ) ); $wp_customize->add_control( 'santamas_banner_effect', array( 'settings' => 'santamas_banner_effect', 'section' => 'santamas_banner_section', 'type' => 'select', 'label' => esc_html__( 'Banner Overylay Effect', 'santamas' ), 'choices' => array( 'none' => esc_html__( 'No Effect', 'santamas' ), 'snow' => esc_html__( 'Snow Effect', 'santamas' ), 'snowflakes' => esc_html__( 'Snowflakes Effect', 'santamas' ) ) ) ); $wp_customize->add_setting( 'santamas_banner_overlay_color', array( 'default' => 'rgba( 0, 0, 0, 0.1)', 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Customize_Alpha_Color_Control( $wp_customize, 'santamas_banner_overlay_color', array( 'label' => esc_html__( 'Banner Overlay Color', 'santamas' ), 'section' => 'santamas_banner_section', 'settings' => 'santamas_banner_overlay_color', 'show_opacity' => true, 'palette' => array( 'rgba(187, 29, 157, 0.3)', 'rgba(130, 130, 130, 0.3)', 'rgba(197, 53, 70, 0.3)', 'rgba(28, 9, 117, 0.4)', 'rgba(83, 93, 36, 0.4)', 'rgba(29, 123, 125, .3)', 'rgb(0, 0, 0, 0.4)' ) ) ) ); $wp_customize->add_setting( 'santamas_banner_caption_color', array( 'default' => '#FFFFFF', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'santamas_banner_caption_color', array( 'label' => esc_html__( 'Banner Text Color', 'santamas' ), 'section' => 'santamas_banner_section', 'settings' => 'santamas_banner_caption_color', ) ) ); $wp_customize->add_section( 'santamas_about_section', array( 'title' => esc_html__( 'About Section', 'santamas' ), 'panel' => 'santamas_home_panel', ) ); $wp_customize->add_setting( 'santamas_disable_about', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_about', array( 'settings' => 'santamas_disable_about', 'section' => 'santamas_about_section', 'label' => esc_html__( 'Disable About Section', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); $wp_customize->add_setting( 'santamas_about_page', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'santamas_about_page', array( 'settings' => 'santamas_about_page', 'section' => 'santamas_about_section', 'type' => 'dropdown-pages', 'label' => esc_html__( 'Select a Page', 'santamas' ), 'description' => esc_html__( 'Upload featured image in the page to display in the left side', 'santamas' ), ) ); //ENABLE/DISABLE COUNTER SECTION $wp_customize->add_setting( 'santamas_disable_counter', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_counter', array( 'settings' => 'santamas_disable_counter', 'section' => 'santamas_about_section', 'label' => esc_html__( 'Disable Counter', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); //COUNTERS for( $i = 1; $i < 5; $i++ ){ $wp_customize->add_setting( 'santamas_counter_heading'.$i, array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Customize_Heading( $wp_customize, 'santamas_counter_heading'.$i, array( 'settings' => 'santamas_counter_heading'.$i, 'section' => 'santamas_about_section', 'label' => esc_html__( 'Counter', 'santamas' ).$i, ) ) ); $wp_customize->add_setting( 'santamas_counter_count'.$i, array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'santamas_counter_count'.$i, array( 'settings' => 'santamas_counter_count'.$i, 'section' => 'santamas_about_section', 'type' => 'number', 'label' => esc_html__( 'Counter Value', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_counter_title'.$i, array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( 'santamas_counter_title'.$i, array( 'settings' => 'santamas_counter_title'.$i, 'section' => 'santamas_about_section', 'type' => 'text', 'label' => esc_html__( 'Title', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_counter_icon'.$i, array( 'default' => 'fa fa-bell', 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Fontawesome_Icon_Chooser( $wp_customize, 'santamas_counter_icon'.$i, array( 'settings' => 'santamas_counter_icon'.$i, 'section' => 'santamas_about_section', 'type' => 'icon', 'label' => esc_html__( 'Counter Icon', 'santamas' ) ) ) ); } $wp_customize->add_section( 'santamas_event_counter_section', array( 'title' => esc_html__( 'Event Counter Section', 'santamas' ), 'panel' => 'santamas_home_panel', ) ); $wp_customize->add_setting( 'santamas_disable_event', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_event', array( 'settings' => 'santamas_disable_event', 'section' => 'santamas_event_counter_section', 'label' => esc_html__( 'Disable Event Section', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); $wp_customize->add_setting( 'santamas_event_info', array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( 'santamas_event_info', array( 'settings' => 'santamas_event_info', 'section' => 'santamas_event_counter_section', 'type' => 'textarea', 'label' => esc_html__( 'Event Info ', 'santamas' ), ) ); $wp_customize->add_setting( 'santamas_event_date', array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Date_Picker_Custom_Control( $wp_customize, 'santamas_event_date', array( 'settings' => 'santamas_event_date', 'section' => 'santamas_event_counter_section', 'label' => esc_html__( 'Event Date ', 'santamas' ), ) ) ); /*============FEATURED SECTION PANEL============*/ $wp_customize->add_section( 'santamas_featured_section', array( 'title' => esc_html__( 'Featured Section', 'santamas' ), 'panel' => 'santamas_home_panel' ) ); $wp_customize->add_setting( 'santamas_disable_featured', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_featured', array( 'settings' => 'santamas_disable_featured', 'section' => 'santamas_featured_section', 'label' => esc_html__( 'Disable Featured Section', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); $wp_customize->add_setting( 'santamas_featured_effect', array( 'default' => 'none', 'sanitize_callback' => 'santamas_sanitize_choices' ) ); $wp_customize->add_control( 'santamas_featured_effect', array( 'settings' => 'santamas_featured_effect', 'section' => 'santamas_featured_section', 'type' => 'select', 'label' => esc_html__( 'Overylay Effect', 'santamas' ), 'choices' => array( 'none' => esc_html__( 'No Effect', 'santamas' ), 'snow' => esc_html__( 'Snow Effect', 'santamas' ) ) ) ); $wp_customize->add_setting( 'santamas_featured_title_sub_title_heading', array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Customize_Heading( $wp_customize, 'santamas_featured_title_sub_title_heading', array( 'settings' => 'santamas_featured_title_sub_title_heading', 'section' => 'santamas_featured_section', 'label' => esc_html__( 'Section Title & Sub Title', 'santamas' ), ) ) ); $wp_customize->add_setting( 'santamas_featured_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_featured_title', array( 'settings' => 'santamas_featured_title', 'section' => 'santamas_featured_section', 'type' => 'text', 'label' => esc_html__( 'Title', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_featured_sub_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_featured_sub_title', array( 'settings' => 'santamas_featured_sub_title', 'section' => 'santamas_featured_section', 'type' => 'textarea', 'label' => esc_html__( 'Sub Title', 'santamas' ), ) ); //FEATURED PAGES for( $i = 1; $i < 4; $i++ ){ $wp_customize->add_setting( 'santamas_featured_header'.$i, array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Customize_Heading( $wp_customize, 'santamas_featured_header'.$i, array( 'settings' => 'santamas_featured_header'.$i, 'section' => 'santamas_featured_section', 'label' => esc_html__( 'Featured Page ', 'santamas' ).$i ) ) ); $wp_customize->add_setting( 'santamas_featured_page'.$i, array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'santamas_featured_page'.$i, array( 'settings' => 'santamas_featured_page'.$i, 'section' => 'santamas_featured_section', 'type' => 'dropdown-pages', 'label' => esc_html__( 'Select a Page', 'santamas' ) ) ); } /*============BLOG PANEL============*/ $wp_customize->add_section( 'santamas_blog_section', array( 'title' => esc_html__( 'Blog Section', 'santamas' ), 'panel' => 'santamas_home_panel' ) ); $wp_customize->add_setting( 'santamas_disable_blog', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_blog', array( 'settings' => 'santamas_disable_blog', 'section' => 'santamas_blog_section', 'label' => esc_html__( 'Disable Blog Section', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); $wp_customize->add_setting( 'santamas_blog_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_blog_title', array( 'settings' => 'santamas_blog_title', 'section' => 'santamas_blog_section', 'type' => 'text', 'label' => esc_html__( 'Title', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_blog_sub_title', array( 'sanitize_callback' => 'santamas_sanitize_text', ) ); $wp_customize->add_control( 'santamas_blog_sub_title', array( 'settings' => 'santamas_blog_sub_title', 'section' => 'santamas_blog_section', 'type' => 'textarea', 'label' => esc_html__( 'Sub Title', 'santamas' ) ) ); //BLOG SETTINGS $wp_customize->add_setting( 'santamas_blog_cat_exclude', array( 'sanitize_callback' => 'santamas_sanitize_text' ) ); $wp_customize->add_control( new Santamas_Customize_Checkbox_Multiple( $wp_customize, 'santamas_blog_cat_exclude', array( 'label' => esc_html__('Exclude Category from Blog Posts', 'santamas'), 'section' => 'santamas_blog_section', 'settings' => 'santamas_blog_cat_exclude', 'choices' => $santamas_cat ) ) ); //GALLERY SECTION $wp_customize->add_section( 'santamas_gallery_section', array( 'panel' => 'santamas_home_panel', 'title' => esc_html__( 'Gallery Section', 'santamas' ) ) ); $wp_customize->add_setting( 'santamas_disable_gallery', array( 'sanitize_callback' => 'santamas_sanitize_text', 'default' => 'off' ) ); $wp_customize->add_control( new Santamas_Switch_Control( $wp_customize, 'santamas_disable_gallery', array( 'settings' => 'santamas_disable_gallery', 'section' => 'santamas_gallery_section', 'label' => esc_html__( 'Disable Gallery Section', 'santamas' ), 'on_off_label' => array( 'on' => esc_html__( 'Yes', 'santamas' ), 'off' => esc_html__( 'No', 'santamas' ) ) ) ) ); $wp_customize->add_setting( 'santamas_gallery_image', array( 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new Santamas_Gallery_Control( $wp_customize, 'santamas_gallery_image', array( 'label' => esc_html__( 'Upload Gallery Image', 'santamas' ), 'section' => 'santamas_gallery_section', 'settings' => 'santamas_gallery_image', ) ) ); } add_action( 'customize_register', 'santamas_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function santamas_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function santamas_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function santamas_customize_preview_js() { wp_enqueue_script( 'santamas-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'santamas_customize_preview_js' ); function santamas_customizer_script() { wp_enqueue_script( 'santamas-customizer-script', get_template_directory_uri() .'/inc/customizer/js/customizer-scripts.js', array('jquery'),'', true ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() .'/css/font-awesome.css'); wp_enqueue_style( 'santamas-customizer-style', get_template_directory_uri() .'/inc/customizer/css/customizer-style.css'); } add_action( 'customize_controls_enqueue_scripts', 'santamas_customizer_script' ); if( class_exists( 'WP_Customize_Control' ) ): class Santamas_Fontawesome_Icon_Chooser extends WP_Customize_Control{ public $type = 'icon'; public function render_content(){ ?> choices ) ) return; ?> label ); ?> description ) ) : ?> description); ?> value() ) ? explode( ',', $this->value() ) : $this->value(); ?> link(); ?> value="" /> label ) ) : ?>

label ); ?>

description){ ?> description); ?> cats = get_categories($options); parent::__construct( $manager, $id, $args ); } public function render_content(){ if(!empty($this->cats)){ ?> on_off_label = $args['on_off_label']; parent::__construct( $manager, $id, $args ); } public function render_content(){ ?> label ); ?> description){ ?> description); ?> value() == 'on') ? 'switch-on' : ''; $on_off_label = $this->on_off_label; ?>
link(); ?> type="hidden" value="value()); ?>"/> label ); ?> description){ ?> description); ?> get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } function santamas_sanitize_choices_array( $input, $setting ) { global $wp_customize; if(!empty($input)){ $input = array_map('absint', $input); } return $input; }