| 1 |
<?php |
| 2 |
/* Slider Section */ |
| 3 |
$wp_customize->add_section( 'slider_section' , array( |
| 4 |
'title' => __('Hero settings', 'spicebox'), |
| 5 |
'panel' => 'section_settings', |
| 6 |
'priority' => 1, |
| 7 |
) ); |
| 8 |
|
| 9 |
// Enable slider |
| 10 |
$wp_customize->add_setting( 'home_page_slider_enabled' , array( 'default' => 'on') ); |
| 11 |
$wp_customize->add_control( 'home_page_slider_enabled' , array( |
| 12 |
'label' => __( 'Enable Hero Section', 'spicebox' ), |
| 13 |
'section' => 'slider_section', |
| 14 |
'type' => 'radio', |
| 15 |
'choices' => array( |
| 16 |
'on'=>__('ON', 'spicebox'), |
| 17 |
'off'=>__('OFF', 'spicebox') |
| 18 |
) |
| 19 |
)); |
| 20 |
|
| 21 |
|
| 22 |
//Slider Image |
| 23 |
$wp_customize->add_setting( 'home_slider_image',array('default' => SPICEB_PLUGIN_URL .'inc/innofit/images/slider/slider.jpg', |
| 24 |
'sanitize_callback' => 'esc_url_raw', 'transport' => $selective_refresh,)); |
| 25 |
|
| 26 |
$wp_customize->add_control( |
| 27 |
new WP_Customize_Image_Control( |
| 28 |
$wp_customize, |
| 29 |
'home_slider_image', |
| 30 |
array( |
| 31 |
'type' => 'upload', |
| 32 |
'label' => __('Image','spicebox'), |
| 33 |
'settings' =>'home_slider_image', |
| 34 |
'section' => 'slider_section', |
| 35 |
|
| 36 |
) |
| 37 |
) |
| 38 |
); |
| 39 |
|
| 40 |
// Image overlay |
| 41 |
$wp_customize->add_setting( 'slider_image_overlay', array( |
| 42 |
'default' => true, |
| 43 |
'sanitize_callback' => 'sanitize_text_field', |
| 44 |
) ); |
| 45 |
|
| 46 |
$wp_customize->add_control('slider_image_overlay', array( |
| 47 |
'label' => __('Enable slider image overlay', 'spicebox' ), |
| 48 |
'section' => 'slider_section', |
| 49 |
'type' => 'checkbox', |
| 50 |
) ); |
| 51 |
|
| 52 |
|
| 53 |
//Slider Background Overlay Color |
| 54 |
$wp_customize->add_setting( 'slider_overlay_section_color', array( |
| 55 |
'sanitize_callback' => 'sanitize_text_field', |
| 56 |
'default' => 'rgba(0,0,0,0.30)', |
| 57 |
) ); |
| 58 |
|
| 59 |
$wp_customize->add_control(new innofit_Customize_Alpha_Color_Control( $wp_customize,'slider_overlay_section_color', array( |
| 60 |
'label' => __('Slider image overlay color','spicebox' ), |
| 61 |
'palette' => true, |
| 62 |
'section' => 'slider_section') |
| 63 |
) ); |
| 64 |
|
| 65 |
|
| 66 |
// Slider title |
| 67 |
$wp_customize->add_setting( 'home_slider_title',array( |
| 68 |
'default' => __('We provide solutions to<br /> grow your business','spicebox'), |
| 69 |
'sanitize_callback' => 'spiceb_innofit_home_page_sanitize_text', |
| 70 |
'transport' => $selective_refresh, |
| 71 |
)); |
| 72 |
$wp_customize->add_control( 'home_slider_title',array( |
| 73 |
'label' => __('Title','spicebox'), |
| 74 |
'section' => 'slider_section', |
| 75 |
'type' => 'text', |
| 76 |
)); |
| 77 |
|
| 78 |
//Slider discription |
| 79 |
$wp_customize->add_setting( 'home_slider_discription',array( |
| 80 |
'default' => __('Welcome to Innofit','spicebox'), |
| 81 |
'sanitize_callback' => 'spiceb_innofit_home_page_sanitize_text', |
| 82 |
'transport' => $selective_refresh, |
| 83 |
)); |
| 84 |
$wp_customize->add_control( 'home_slider_discription',array( |
| 85 |
'label' => __('Description','spicebox'), |
| 86 |
'section' => 'slider_section', |
| 87 |
'type' => 'textarea', |
| 88 |
)); |
| 89 |
|
| 90 |
|
| 91 |
// Slider button text |
| 92 |
$wp_customize->add_setting( 'home_slider_btn_txt',array( |
| 93 |
'default' => __('Read more','spicebox'), |
| 94 |
'sanitize_callback' => 'spiceb_innofit_home_page_sanitize_text', |
| 95 |
'transport' => $selective_refresh, |
| 96 |
)); |
| 97 |
$wp_customize->add_control( 'home_slider_btn_txt',array( |
| 98 |
'label' => __('Button Text','spicebox'), |
| 99 |
'section' => 'slider_section', |
| 100 |
'type' => 'text', |
| 101 |
)); |
| 102 |
|
| 103 |
// Slider button link |
| 104 |
$wp_customize->add_setting( 'home_slider_btn_link',array( |
| 105 |
'default' => __('#','spicebox'), |
| 106 |
'sanitize_callback' => 'spiceb_innofit_home_page_sanitize_text', |
| 107 |
'transport' => $selective_refresh, |
| 108 |
)); |
| 109 |
$wp_customize->add_control( 'home_slider_btn_link',array( |
| 110 |
'label' => __('Button Link','spicebox'), |
| 111 |
'section' => 'slider_section', |
| 112 |
'type' => 'text', |
| 113 |
)); |
| 114 |
|
| 115 |
// Slider button target |
| 116 |
$wp_customize->add_setting( |
| 117 |
'home_slider_btn_target', |
| 118 |
array( |
| 119 |
'default' => false, |
| 120 |
'sanitize_callback' => 'spiceb_innofit_home_page_sanitize_text', |
| 121 |
)); |
| 122 |
$wp_customize->add_control('home_slider_btn_target', array( |
| 123 |
'label' => __('Open link in new tab', 'spicebox'), |
| 124 |
'section' => 'slider_section', |
| 125 |
'type' => 'checkbox', |
| 126 |
)); |
| 127 |
|
| 128 |
|
| 129 |
/** |
| 130 |
* Add selective refresh for Front page slider section controls. |
| 131 |
*/ |
| 132 |
|
| 133 |
$wp_customize->selective_refresh->add_partial( 'home_slider_image', array( |
| 134 |
'selector' => 'main-slider .item', |
| 135 |
'settings' => 'home_slider_image', |
| 136 |
|
| 137 |
) ); |
| 138 |
|
| 139 |
$wp_customize->selective_refresh->add_partial( 'home_slider_title', array( |
| 140 |
'selector' => '.caption-content .title', |
| 141 |
'settings' => 'home_slider_title', |
| 142 |
'render_callback' => 'spiceb_innofit_slider_section_title_render_callback', |
| 143 |
|
| 144 |
) ); |
| 145 |
|
| 146 |
$wp_customize->selective_refresh->add_partial( 'home_slider_discription', array( |
| 147 |
'selector' => '.caption-content .subtitle', |
| 148 |
'settings' => 'home_slider_discription', |
| 149 |
'render_callback' => 'spiceb_innofit_slider_section_discription_render_callback', |
| 150 |
|
| 151 |
) ); |
| 152 |
|
| 153 |
$wp_customize->selective_refresh->add_partial( 'home_slider_btn_txt', array( |
| 154 |
'selector' => '.main-slider .btn-small', |
| 155 |
'settings' => 'home_slider_btn_txt', |
| 156 |
'render_callback' => 'spiceb_innofit_slider_btn_render_callback', |
| 157 |
|
| 158 |
) ); |
| 159 |
|