add_section('page_boxes',array( 'title' => esc_html__('Home Boxes','beautystyle'), 'description' => ( esc_html__( 'Images dimensions: ( 270 X 170 ) - the posts thumbnails image for these pages will be selected', 'beautystyle' )), 'priority' => 101 )); //box 1 $wp_customize->add_setting('page-setting1',array( 'sanitize_callback' => 'beautystyle_sanitize_integer' )); $wp_customize->add_control('page-setting1',array( 'type' => 'dropdown-pages', 'label' => esc_html__('Select pages for box 1:','beautystyle'), 'section' => 'page_boxes' )); $wp_customize->add_setting('page-extract1',array( 'default' =>esc_html__('Insert a short summary','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('page-extract1',array( 'type' => 'textarea', 'label' => esc_html__('Insert a short summary','beautystyle'), 'section' => 'page_boxes' )); //box 2 $wp_customize->add_setting('page-setting2',array( 'sanitize_callback' => 'beautystyle_sanitize_integer' )); $wp_customize->add_control('page-setting2',array( 'type' => 'dropdown-pages', 'label' => esc_html__('Select pages for box 2:','beautystyle'), 'section' => 'page_boxes' )); $wp_customize->add_setting('page-extract2',array( 'default' => esc_html__('Insert a short summary','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('page-extract2',array( 'type' => 'textarea', 'label' => esc_html__('Insert a short summary','beautystyle'), 'section' => 'page_boxes' )); //box 3 $wp_customize->add_setting('page-setting3',array( 'sanitize_callback' => 'beautystyle_sanitize_integer' )); $wp_customize->add_control('page-setting3',array( 'type' => 'dropdown-pages', 'label' => esc_html__('Select pages for box 3:','beautystyle'), 'section' => 'page_boxes' )); $wp_customize->add_setting('page-extract3',array( 'default' => esc_html__('Insert a short summary','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('page-extract3',array( 'type' => 'textarea', 'label' => esc_html__('Insert a short summary','beautystyle'), 'section' => 'page_boxes' )); //hide box $wp_customize->add_setting('hide_boxes',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hide_boxes', array( 'section' => 'page_boxes', 'label' => esc_html__('Hide this section','beautystyle'), 'type' => 'checkbox' )); /* --------------------------------------- */ /* Slider box*/ /* ---------------------------------------- */ $wp_customize->add_section('slider_box',array( 'title' => esc_html__('Slider Box','beautystyle'), 'description' => ( esc_html__( 'Slider images: Images must have same dimensions - recommended 1400x550', 'beautystyle' )), 'priority' => 100, )); $wp_customize->add_setting('custom_slide1',array( 'default' => get_template_directory_uri() . '/assets/img/environment.jpg', 'transport' => 'refresh', 'height' => 550, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_setting('custom_slide2',array( 'default' => get_template_directory_uri() . '/assets/img/environment.jpg', 'transport' => 'refresh', 'height' => 550, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_setting('custom_slide3',array( 'default' => get_template_directory_uri() . '/assets/img/environment.jpg', 'transport' => 'refresh', 'height' => 550, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_slide1_control' ,array( 'label' => esc_html__('Slider Image 1', 'beautystyle'), 'section' => 'slider_box', 'settings' => 'custom_slide1' ))); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_slide2_control' ,array( 'label' => esc_html__('Slider Image 2', 'beautystyle'), 'section' => 'slider_box', 'settings' => 'custom_slide2' ))); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_slide3_control' ,array( 'label' => esc_html__('Slider Image 3', 'beautystyle'), 'section' => 'slider_box', 'settings' => 'custom_slide3' ))); //hide box $wp_customize->add_setting('slider_hide_box',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('slider_hide_box', array( 'section' => 'slider_box', 'label' => esc_html__('Hide this section','beautystyle'), 'type' => 'checkbox' )); /* --------------------------------------- */ /* Home posts*/ /* ---------------------------------------- */ $wp_customize->add_section('posts_section',array( 'title' => esc_html__('Posts Section','beautystyle'), 'description' => ( esc_html__( 'Show or hide posts section', 'beautystyle' )), 'priority' => 102 )); $wp_customize->add_setting('hide_posts_section',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hide_posts_section', array( 'section' => 'posts_section', 'label' => esc_html__('Hide this section','beautystyle'), 'type' => 'checkbox' )); /* --------------------------------------- */ /* Footer */ /* ---------------------------------------- */ $wp_customize->add_section('footer_box',array( 'title' => esc_html__('Footer Text Box','beautystyle'), 'description' => ( esc_html__('Company description', 'beautystyle' )), 'priority' => 103 )); // Title and description $wp_customize->add_setting('TextBox_title',array( 'default' => esc_html__('Title here','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('TextBox_title',array( 'type' => 'text', 'label' => esc_html__('Add title','beautystyle'), 'setting' => 'TextBox_title', 'section' => 'footer_box', )); $wp_customize->add_setting('TextBox_desc',array( 'default' => esc_html__('Description here','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('TextBox_desc',array( 'type' => 'textarea', 'label' => esc_html__('Add about description here','beautystyle'), 'setting' => 'TextBox_desc', 'section' => 'footer_box' )); // Contact Details $wp_customize->add_section('footer_contact',array( 'title' => esc_html__('Footer Contact Details','beautystyle'), 'description' => ( esc_html__( 'Add your contact details here', 'beautystyle' )), 'priority' => 104 )); $wp_customize->add_setting('contact_title',array( 'default' => esc_html__('Contact Us','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('contact_title',array( 'type' => 'text', 'label' => esc_html__('Add contact title','beautystyle'), 'setting' => 'contact_title', 'section' => 'footer_contact' )); $wp_customize->add_setting('contact_adress',array( 'default' => esc_html__('Adress','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('contact_adress',array( 'type' => 'text', 'label' => esc_html__('Add adress','beautystyle'), 'setting' => 'contact_adress', 'section' => 'footer_contact' )); $wp_customize->add_setting('cotact_phone',array( 'default' => esc_html__('+123456789','beautystyle'), 'sanitize_callback' => 'sanitize_text' )); $wp_customize->add_control('cotact_phone',array( 'type' => 'text', 'label' => esc_html__('Add telephone number','beautystyle'), 'setting' => 'cotact_phone', 'section' => 'footer_contact' )); $wp_customize->add_setting('contact_mail',array( 'default' => esc_html__('info@beautystyle.com','beautystyle'), 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('contact_mail',array( 'type' => 'text', 'label' => esc_html__('Add e-mail','beautystyle'), 'setting' => 'contact_mail', 'section' => 'footer_contact' )); // Social link settings $wp_customize->add_section('social_sec',array( 'title' => esc_html__('Footer Social Settings','beautystyle'), 'description' => __( 'Add social icons link here', 'beautystyle' ), 'priority' => 105 )); $wp_customize->add_setting('fb_link',array( 'default' => '#facebook', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('fb_link',array( 'label' => esc_html__('Add Facebook link here','beautystyle'), 'setting' => 'fb_link', 'section' => 'social_sec' )); $wp_customize->add_setting('twitt_link',array( 'default' => '#twitter', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('twitt_link',array( 'label' => esc_html__('Add Twitter link here','beautystyle'), 'setting' => 'twitt_link', 'section' => 'social_sec' )); $wp_customize->add_setting('ig_link',array( 'default' => '#ig', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('ig_link',array( 'label' => __('Add Instagram plus link here','beautystyle'), 'setting' => 'ig_link', 'section' => 'social_sec' )); $wp_customize->add_setting('linked_link',array( 'default' => '#linkedin', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('linked_link',array( 'label' => __('Add Linkedin link here','beautystyle'), 'setting' => 'linked_link', 'section' => 'social_sec' )); $wp_customize->add_setting('wha_link',array( 'default' => '#whatsapp', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('wha_link',array( 'label' => __('Add Whatsapp link here','beautystyle'), 'setting' => 'wha_link', 'section' => 'social_sec' )); $wp_customize->add_setting('tiktok_link',array( 'default' => '#tiktok', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('tiktok_link',array( 'label' => __('Add TikTok link here','beautystyle'), 'setting' => 'tiktok_link', 'section' => 'social_sec' )); // Sanitize text function sanitize_text( $text ) { return sanitize_text_field( $text ); } } add_action( 'customize_register', 'beautystyle_homeboxes' ); /* --------------------------------------- */ /* Sanitizes */ /* ---------------------------------------- */ //integer number function beautystyle_sanitize_integer( $input ) { if( is_numeric( $input ) ) { return intval( $input ); } } ?>