| 1 |
<?php |
| 2 |
// contact form section settings |
| 3 |
$wp_customize->add_section('home_contactform_section',array( |
| 4 |
'title'=>'Contact form section settings', |
| 5 |
'description'=>'', |
| 6 |
'panel' => 'section_settings', |
| 7 |
'priority' => 13, |
| 8 |
)); |
| 9 |
|
| 10 |
|
| 11 |
$wp_customize->add_setting( 'contact_form_enable' , array( 'default' => 'on') ); |
| 12 |
$wp_customize->add_control( 'contact_form_enable' , array( |
| 13 |
'label' => __( 'Enable Contact form section', 'spicebox' ), |
| 14 |
'section' => 'home_contactform_section', |
| 15 |
'type' => 'radio', |
| 16 |
'choices' => array( |
| 17 |
'on'=>__('ON', 'spicebox'), |
| 18 |
'off'=>__('OFF', 'spicebox') |
| 19 |
) |
| 20 |
)); |
| 21 |
|
| 22 |
//Contact form section Background Image |
| 23 |
$wp_customize->add_setting( 'contact_form_background', array('default' => get_template_directory_uri().'/images/testimonial-bg.jpg', |
| 24 |
'sanitize_callback' => 'esc_url_raw', |
| 25 |
) ); |
| 26 |
|
| 27 |
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'contact_form_background', array( |
| 28 |
'label' => __( 'Background Image', 'spicebox' ), |
| 29 |
'section' => 'home_contactform_section', |
| 30 |
'settings' => 'contact_form_background', |
| 31 |
) ) ); |
| 32 |
|
| 33 |
// Image overlay |
| 34 |
$wp_customize->add_setting( 'contact_form_image_overlay', array( |
| 35 |
'default' => true, |
| 36 |
'sanitize_callback' => 'sanitize_text_field', |
| 37 |
) ); |
| 38 |
|
| 39 |
$wp_customize->add_control('contact_form_image_overlay', array( |
| 40 |
'label' => __('Enable Contact image overlay', 'spicebox' ), |
| 41 |
'section' => 'home_contactform_section', |
| 42 |
'type' => 'checkbox', |
| 43 |
) ); |
| 44 |
|
| 45 |
|
| 46 |
//Testimonial Background Overlay Color |
| 47 |
$wp_customize->add_setting( 'contact_overlay_section_color', array( |
| 48 |
'default' => 'rgba(250, 250, 250, 0.95)', |
| 49 |
) ); |
| 50 |
|
| 51 |
$wp_customize->add_control(new Innofit_Customize_Alpha_Color_Control( $wp_customize,'contact_overlay_section_color', array( |
| 52 |
'label' => __('Contact image overlay color','spicebox' ), |
| 53 |
'palette' => true, |
| 54 |
'section' => 'home_contactform_section') |
| 55 |
) ); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
// contact form title |
| 61 |
$wp_customize->add_setting('contact_form_title_one',array( |
| 62 |
'capability' => 'edit_theme_options', |
| 63 |
'default' => __('Send us a message','spicebox'), |
| 64 |
'sanitize_callback' => 'innofit_home_page_sanitize_text', |
| 65 |
'transport' => $selective_refresh, |
| 66 |
)); |
| 67 |
$wp_customize->add_control('contact_form_title_one',array( |
| 68 |
'label' => __('Contact form title one','spicebox'), |
| 69 |
'section' => 'home_contactform_section', |
| 70 |
'type' => 'text', |
| 71 |
)); |
| 72 |
|
| 73 |
// Contact title |
| 74 |
$wp_customize->add_setting('contact_form_title_two',array( |
| 75 |
'capability' => 'edit_theme_options', |
| 76 |
'default' => __('Contact Us','spicebox'), |
| 77 |
'sanitize_callback' => 'innofit_home_page_sanitize_text', |
| 78 |
'transport' => $selective_refresh, |
| 79 |
)); |
| 80 |
$wp_customize->add_control('contact_form_title_two',array( |
| 81 |
'label' => __('Contact form title two','spicebox'), |
| 82 |
'section' => 'home_contactform_section', |
| 83 |
'type' => 'text', |
| 84 |
)); |
| 85 |
|
| 86 |
// Contact form 7 shortcode |
| 87 |
$wp_customize->add_setting('contact_form_shortcode',array( |
| 88 |
'capability' => 'edit_theme_options', |
| 89 |
'sanitize_callback' => 'sanitize_text_field', |
| 90 |
)); |
| 91 |
$wp_customize->add_control('contact_form_shortcode',array( |
| 92 |
'label' => __('Contact Form shortcode','spicebox'), |
| 93 |
'section' => 'home_contactform_section', |
| 94 |
'type' => 'textarea', |
| 95 |
)); |
| 96 |
|
| 97 |
|
| 98 |
// contact info enable / disable |
| 99 |
$wp_customize->add_setting('contact_info_enable',array( |
| 100 |
'default'=>true, |
| 101 |
'capability' => 'edit_theme_options', |
| 102 |
'sanitize_callback' => 'sanitize_text_field', |
| 103 |
)); |
| 104 |
$wp_customize->add_control('contact_info_enable',array( |
| 105 |
'label' => __('Enable contact info','spicebox'), |
| 106 |
'section' => 'home_contactform_section', |
| 107 |
'type' => 'checkbox', |
| 108 |
)); |
| 109 |
|
| 110 |
//Contact section content |
| 111 |
if ( class_exists( 'Innofit_Page_Editor' ) ) { |
| 112 |
$default = __('<h2 class="title">Get in touch</h2><aside class="contact-widget"><div class="media"><div class="contact-icon"><i class="fa fa-map-marker"></i></div><div class="media-body"><h3 class="title">Find Us</h3><address>Porterfield 508 Virginia Street Chicago,<br> IL 60653 (USA)</address></div></div></aside><aside class="contact-widget"><div class="media"><div class="contact-icon"><i class="fa fa-mobile"></i></div><div class="media-body"><h3 class="title">Phone</h3><address>Mobile: (+91) 90 1900 - 6886 <br>Hotline: 1800 6886)</address></div></div></aside><aside class="contact-widget"><div class="media"><div class="contact-icon"><i class="fa fa-envelope-o"></i></div><div class="media-body"><h3 class="title">Email</h3><address><a href="mailto:suppor@tinnofit.com">support@innofit.com</a><a href="mailto:contact@innofit.com">contact@innofit.com</a></address></div></div></aside>','spicebox'); |
| 113 |
$wp_customize->add_setting( |
| 114 |
'contact_info_content', array( |
| 115 |
'default' => $default, |
| 116 |
'sanitize_callback' => 'wp_kses_post', |
| 117 |
) |
| 118 |
); |
| 119 |
|
| 120 |
$wp_customize->add_control( |
| 121 |
new Innofit_Page_Editor( |
| 122 |
$wp_customize, 'contact_info_content', array( |
| 123 |
'label' => esc_html__( 'Contact Info content', 'spicebox' ), |
| 124 |
'section' => 'home_contactform_section', |
| 125 |
'priority' => 10, |
| 126 |
'needsync' => true, |
| 127 |
) |
| 128 |
) |
| 129 |
); |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
/** |
| 134 |
* Add selective refresh for Front page contact section controls. |
| 135 |
*/ |
| 136 |
|
| 137 |
|
| 138 |
$wp_customize->selective_refresh->add_partial( 'contact_form_title_one', array( |
| 139 |
'selector' => '.contact .contact-form .subtitle', |
| 140 |
'settings' => 'contact_form_title_one', |
| 141 |
'render_callback' => 'contact_form_title_one_render_callback', |
| 142 |
|
| 143 |
) ); |
| 144 |
|
| 145 |
$wp_customize->selective_refresh->add_partial( 'contact_form_title_two', array( |
| 146 |
'selector' => '.contact .contact-form .title', |
| 147 |
'settings' => 'contact_form_title_two', |
| 148 |
'render_callback' => 'contact_form_title_two_render_callback', |
| 149 |
|
| 150 |
) ); |
| 151 |
|
| 152 |
$wp_customize->selective_refresh->add_partial( 'contact_info_content', array( |
| 153 |
'selector' => '.contact .contact-info h2', |
| 154 |
'settings' => 'contact_info_content', |
| 155 |
'render_callback' => 'contact_info_content_render_callback', |
| 156 |
|
| 157 |
) ); |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
?> |