add_panel( 'front_page_advertisement', array( 'title' => __( 'Front page section "Advertisement"', 'aniro-hotel-light' ), 'description' => __( 'Front page section "Advertisement" - options.', 'aniro-hotel-light' ), 'priority' => 42, ) ); //****************************************************************************** //Add section Front page "advertisement" //****************************************************************************** $wp_customize->add_section( 'front_page_advertisement_section' , array( 'title' => __( 'Advertisement - title', 'aniro-hotel-light' ), 'panel' => 'front_page_advertisement', 'priority' => 1, 'description' => __( 'Add title', 'aniro-hotel-light' ) ) ); //****************************************************************************** //Add section "Adverticement - background" //****************************************************************************** $wp_customize->add_section( 'front_page_advertisement_bg' , array( 'title' => __( 'Advertisement - background', 'aniro-hotel-light' ), 'panel' => 'front_page_advertisement', 'priority' => 1, 'description' => __( 'Add background image for section "Advertisement".', 'aniro-hotel-light' ) ) ); //image $wp_customize->add_setting( 'anirohotellight_advertisement_bg', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'anirohotellight_advertisement_bg', array( 'label' => esc_html__( 'Add background image for "Advertisement" section - the recommended image size is 1300x500px', 'aniro-hotel-light' ), 'type' => 'image', 'section' => 'front_page_advertisement_bg', 'settings' => 'anirohotellight_advertisement_bg', ))); //add color for filtr $wp_customize->add_setting( 'anirohotellight_advertisement_bg_filtr', array( 'default' => '#d2691e', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'anirohotellight_advertisement_bg_filtr', array( 'label' => esc_html__( 'Select the filter color for the background image', 'aniro-hotel-light' ), 'section' => 'front_page_advertisement_bg', 'settings' => 'anirohotellight_advertisement_bg_filtr' ) ) ); //select the transparency for the filter $wp_customize->add_setting( 'anirohotellight_advertisement_bg_filtr_alpha', array( 'sanitize_callback' => 'anirohotellight_sanitize_float', 'default' => 1, )); $wp_customize->add_control ( 'anirohotellight_advertisement_bg_filtr_alpha', array( 'type' => 'number', 'label' => esc_html__( 'Select the transparency for the filter', 'aniro-hotel-light' ), 'section' => 'front_page_advertisement_bg', 'settings' => 'anirohotellight_advertisement_bg_filtr_alpha', 'input_attrs' => array( 'min' => 0, 'max' => 1, 'step' => 0.1, 'style' => 'margin-bottom: 15px; padding: 15px;', ), )); //****************************************************************************** //Add section "Add data" //****************************************************************************** $wp_customize->add_section( 'front_page_add_data_advertisement_section' , array( 'title' => __( 'Add data', 'aniro-hotel-light' ), 'panel' => 'front_page_advertisement', 'priority' => 100, 'description' => __( 'Add data.', 'aniro-hotel-light' ) ) ); //Choose advertisement $wp_customize-> add_setting( 'anirohotellight_choose_advertisement', array( 'default' => '', 'sanitization_callback' => 'absint' ) ); $wp_customize-> add_control( new Aniro_Post_Type_Advertisement_Control( $wp_customize, 'anirohotellight_choose_advertisement', array( 'label' => esc_html__('Choose advertisement:','aniro-hotel-light'), 'section' => 'front_page_add_data_advertisement_section', 'settings' => 'anirohotellight_choose_advertisement' ) ) ); // How many words show in adverticement on front page $wp_customize->add_setting('anirohotellight_number_of_words_adverticement', array( 'default' => 35, 'sanitize_callback' => 'absint' )); $wp_customize->add_control('anirohotellight_number_of_words_adverticement', array( 'section' => 'front_page_add_data_advertisement_section', 'label' => esc_html__('How many words show in advertisement on front page','aniro-hotel-light'), 'type' => 'number', 'settings' => 'anirohotellight_number_of_words_adverticement', 'input_attrs' => array( 'min' => 5, 'max' => 56, 'step' => 1, 'style' => 'margin-bottom: 15px; padding: 15px;',) )); //****************************************************************************** //Add section "Show/hide section" //****************************************************************************** $wp_customize->add_section( 'front_page_show_hide_advertisement_section' , array( 'title' => __( 'Show/hide section', 'aniro-hotel-light' ), 'panel' => 'front_page_advertisement', 'priority' => 100, 'description' => __( 'Show/hide this section.', 'aniro-hotel-light' ) ) ); /*********************************************/ // Show/hide section $wp_customize->add_setting('front_page_show_hide_advertisement', array( 'default' => '', 'sanitize_callback' => 'anirohotellight_sanitize_checkbox', )); $wp_customize->add_control('front_page_show_hide_advertisement', array( 'type' => 'checkbox', 'label' => esc_html__( 'Hide this section?', 'aniro-hotel-light' ), 'section' => 'front_page_show_hide_advertisement_section', ) );