ID] = $posts->post_title; } $service_pages = array(); $service_pages_obj = get_pages('posts_per_page=-1'); $service_pages[''] = __( 'Choose Page', 'bizwhoop' ); foreach ( $service_pages_obj as $posts ) { $service_pages[$posts->ID] = $posts->post_title; } $wp_customize->add_panel( 'homepage_setting', array( 'priority' => 400, 'capability' => 'edit_theme_options', 'title' => __('Homepage Settings', 'bizwhoop'), ) ); /* -------------------------------------- ========================================= Slider Section ========================================= -----------------------------------------*/ $wp_customize->add_section( 'bizwhoop_slider_section_settings', array( 'title' => __('Slider Setting','bizwhoop'), 'description' => '', 'panel' => 'homepage_setting', ) ); //Enable slider $wp_customize->add_setting( 'bizwhoop_slider_enable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_slider_enable', array( 'label' => __('Enable Slider Section','bizwhoop'), 'section' => 'bizwhoop_slider_section_settings', 'type' => 'checkbox', ) ); //Select Post One $wp_customize->add_setting('slider_post_one',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('slider_post_one',array( 'label' => __('Select Page One','bizwhoop'), 'section'=>'bizwhoop_slider_section_settings', 'type'=>'select', 'choices'=>$options_pages, )); //Select Post Two $wp_customize->add_setting('slider_post_two',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('slider_post_two',array( 'label' => __('Select Page Two','bizwhoop'), 'section'=>'bizwhoop_slider_section_settings', 'type'=>'select', 'choices'=>$options_pages, )); //Select Post Three $wp_customize->add_setting('slider_post_three',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('slider_post_three',array( 'label' => __('Select Page Three','bizwhoop'), 'section'=>'bizwhoop_slider_section_settings', 'type'=>'select', 'choices'=>$options_pages, )); /* -------------------------------------- ========================================= Serice Section ========================================= -----------------------------------------*/ // add section to manage Services $wp_customize->add_section( 'bizwhoop_service_section_settings', array( 'title' => __('Service Setting','bizwhoop'), 'panel' => 'homepage_setting', ) ); //Enable service $wp_customize->add_setting( 'bizwhoop_service_enable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_service_enable', array( 'label' => __('Enable Service Section','bizwhoop'), 'section' => 'bizwhoop_service_section_settings', 'type' => 'checkbox', ) ); //Service Title setting $wp_customize->add_setting( 'bizwhoop_service_title', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_service_title',array( 'label' => __('Service Title','bizwhoop'), 'section' => 'bizwhoop_service_section_settings', 'type' => 'text', ) ); //Service SubTitle setting $wp_customize->add_setting( 'bizwhoop_service_subtitle', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_service_subtitle', array( 'label' => __('Service Subtitle','bizwhoop'), 'section' => 'bizwhoop_service_section_settings', 'type' => 'textarea', ) ); //Select Service One $wp_customize->add_setting('service_post_one',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('service_post_one',array( 'label' => __('Select Service One','bizwhoop'), 'section'=>'bizwhoop_service_section_settings', 'type'=>'select', 'choices'=>$service_pages, )); //Select Post Two $wp_customize->add_setting('service_post_two',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('service_post_two',array( 'label' => __('Select Service Two','bizwhoop'), 'section'=>'bizwhoop_service_section_settings', 'type'=>'select', 'choices'=>$service_pages, )); //Select Post Three $wp_customize->add_setting('service_post_three',array( 'capability'=>'edit_theme_options', 'sanitize_callback'=>'sanitize_text_field', )); $wp_customize->add_control('service_post_three',array( 'label' => __('Select Service Three','bizwhoop'), 'section'=>'bizwhoop_service_section_settings', 'type'=>'select', 'choices'=>$service_pages, )); /* -------------------------------------- ========================================= Callout Section ========================================= -----------------------------------------*/ // add section to manage Callout $wp_customize->add_section( 'bizwhoop_callout_section_settings', array( 'title' => __('Callout Setting','bizwhoop'), 'description' => '', 'panel' => 'homepage_setting', ) ); //Enable contact $wp_customize->add_setting( 'bizwhoop_callout_enable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_callout_enable', array( 'label' => __('Enable Callout Section','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'checkbox', ) ); //Callout Background image $wp_customize->add_setting( 'bizwhoop_callout_background', array( 'sanitize_callback' => 'bizwhoop_sanitize_image', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bizwhoop_callout_background', array( 'label' => __( 'Choose Background Image', 'bizwhoop' ), 'section' => 'bizwhoop_callout_section_settings', 'settings' => 'bizwhoop_callout_background',) ) ); // Callout Title Setting $wp_customize->add_setting( 'bizwhoop_callout_title', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_callout_title', array( 'label' => __('Callout Title','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'text', ) ); // Callout Description Setting $wp_customize->add_setting( 'bizwhoop_callout_description', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_callout_description', array( 'label' => __('Callout Description','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'textarea', ) ); // Callout Button One Label Setting $wp_customize->add_setting( 'bizwhoop_callout_button_one_label', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_one_label', array( 'label' => __('Button One Title','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'text', ) ); //Callout Button One Link Setting $wp_customize->add_setting( 'bizwhoop_callout_button_one_link', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_one_link',array( 'label' => __('Button One URL','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'text', ) ); //Callout Button One Target Setting $wp_customize->add_setting( 'bizwhoop_callout_button_one_target', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_one_target',array( 'label' => __('Open Link New window','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'checkbox', ) ); //Callout Button Two Label Setting $wp_customize->add_setting( 'bizwhoop_callout_button_two_label', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_two_label', array( 'label' => __('Button Two Title','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'text', ) ); //Callout Button Two Link Setting $wp_customize->add_setting( 'bizwhoop_callout_button_two_link', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_two_link', array( 'label' => __('Button Two URL','bizwhoop'), 'type' => 'text', 'section' => 'bizwhoop_callout_section_settings', ) ); //Callout Button Two Target Setting $wp_customize->add_setting( 'bizwhoop_callout_button_two_target', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_callout_button_two_target', array( 'label' => __('Open Link New window','bizwhoop'), 'section' => 'bizwhoop_callout_section_settings', 'type' => 'checkbox', ) ); /* -------------------------------------- ========================================= Latest News Section ========================================= -----------------------------------------*/ // add section to manage Latest News $wp_customize->add_section( 'news_section_settings', array( 'title' => __('News & Events Setting','bizwhoop'), 'description' => '', 'panel' => 'homepage_setting' ) ); //Enable news $wp_customize->add_setting( 'bizwhoop_news_enable', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_checkbox', ) ); $wp_customize->add_control( 'bizwhoop_news_enable', array( 'label' => __('Enable News Section','bizwhoop'), 'section' => 'news_section_settings', 'type' => 'checkbox', ) ); // Latest News Title Setting $wp_customize->add_setting( 'bizwhoop_news_title', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_news_title',array( 'label' => __('Latest News Title','bizwhoop'), 'section' => 'news_section_settings', 'type' => 'text', ) ); // Latest News Subtitle Setting $wp_customize->add_setting( 'bizwhoop_news_subtitle', array( 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizwhoop_homepage_sanitize_text', ) ); $wp_customize->add_control( 'bizwhoop_news_subtitle',array( 'label' => __('Latest News Subtitle','bizwhoop'), 'section' => 'news_section_settings', 'type' => 'textarea', ) ); function bizwhoop_homepage_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function bizwhoop_homepage_sanitize_checkbox( $input ) { // Boolean check return ( ( isset( $input ) && true == $input ) ? true : false ); } function bizwhoop_sanitize_image( $image, $setting ) { /* * Array of valid image file types. * * The array includes image mime types that are included in wp_get_mime_types() */ $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon' ); // Return an array with file extension and mime_type. $file = wp_check_filetype( $image, $mimes ); // If $image has a valid mime_type, return it; otherwise, return the default. return ( $file['ext'] ? $image : $setting->default ); } } add_action( 'customize_register', 'bizwhoop_homepage_setting' ); ?>