diff --git a/content-frontpage.php b/content-frontpage.php index 29c48bc..602f819 100644 --- a/content-frontpage.php +++ b/content-frontpage.php @@ -79,7 +79,8 @@ } /* CONTACT US */ - $zerif_contactus_show = get_theme_mod( 'zerif_contactus_show' ); + $zerif_contactus_show = get_theme_mod( 'zerif_contactus_show' ); + $zerif_alternative_contact_form = get_theme_mod( 'zerif_contactus_shortcode' ); if ( ( isset( $zerif_contactus_show ) && $zerif_contactus_show != 1 ) || is_customize_preview() ) : echo '
'; @@ -122,12 +123,14 @@ '; - echo do_shortcode( '[pirate_forms]' ); + echo do_shortcode( $zerif_alternative_contact_form ); + echo ''; + elseif ( defined( 'PIRATE_FORMS_VERSION' ) && shortcode_exists( 'pirate_forms' ) ) : + echo '
'; + echo do_shortcode( '[pirate_forms]' ); echo '
'; - endif; ?> diff --git a/functions.php b/functions.php index a970877..07d8796 100644 --- a/functions.php +++ b/functions.php @@ -110,7 +110,14 @@ function zerif_setup() { require_once get_template_directory() . '/ti-prevdem/init-prevdem.php'; /* woocommerce support */ - add_theme_support( 'woocommerce' ); + $woocommerce_settings = apply_filters( + 'zerif_woocommerce_args', array( + 'single_image_width' => 1600, + 'thumbnail_image_width' => 300, + 'gallery_thumbnail_image_width' => 165, + ) + ); + add_theme_support( 'woocommerce', $woocommerce_settings ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); @@ -469,6 +476,35 @@ function zerif_setup() { add_action( 'after_setup_theme', 'zerif_setup' ); +/** + * Add compatibility with WooCommerce Product Images customizer controls. + */ +function zerif_set_woo_image_sizes() { + + $execute = get_option( 'zerif_update_woocommerce_customizer_controls', false ); + if ( $execute !== false ) { + return; + } + + update_option( 'woocommerce_thumbnail_cropping', 'custom' ); + update_option( 'woocommerce_thumbnail_cropping_custom_width', '3' ); + update_option( 'woocommerce_thumbnail_cropping_custom_height', '2' ); + + if ( class_exists( 'WC_Regenerate_Images' ) ) { + $regenerate_obj = new WC_Regenerate_Images(); + $regenerate_obj::init(); + if ( method_exists( $regenerate_obj, 'maybe_regenerate_images' ) ) { + $regenerate_obj::maybe_regenerate_images(); + } elseif ( method_exists( $regenerate_obj, 'maybe_regenerate_images_option_update' ) ) { + // Force woocommerce 3.3.1 to regenerate images + $regenerate_obj::maybe_regenerate_images_option_update( 1, 2, '' ); + } + } + + update_option( 'zerif_update_woocommerce_customizer_controls', true ); +} +add_action( 'after_setup_theme', 'zerif_set_woo_image_sizes', 10 ); + /** * Migrate logo from theme to core */ diff --git a/inc/customizer.php b/inc/customizer.php index a97837b..43ef7cc 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -2271,6 +2271,21 @@ function zerif_blog_header_title_subtitle_callback() { ) ); + /* zerif_contact_shortcode */ + $wp_customize->add_setting( + 'zerif_contactus_shortcode', array( + 'sanitize_callback' => 'zerif_sanitize_input', + ) + ); + $wp_customize->add_control( + 'zerif_contactus_shortcode', array( + 'label' => __( 'Contact Form Shortcode', 'zerif-lite' ), + 'description' => __( 'Or add the shortcode of your choice here.', 'zerif-lite' ), + 'section' => 'zerif_contactus_section', + 'priority' => 2, + ) + ); + /* Use the contact options from the theme, only if Pirate Forms is not installed */ if ( ! defined( 'PIRATE_FORMS_VERSION' ) ) { /* Contactus email */ diff --git a/style.css b/style.css index a26a7b6..caba721 100644 --- a/style.css +++ b/style.css @@ -833,7 +833,72 @@ textarea:focus { border: 1px solid rgba(0, 0, 0, 0.3); outline: 0; } +/* Support for Contact Form 7 plugin */ +.contact-us form.wpcf7-form label, .contact-us form.wpcf7-form .wpcf7-list-item-label { + color: #fff; +} + +form.wpcf7-form p label { + display: block; + text-align: left; +} + +form.wpcf7-form p label > span { + margin-top: 5px; +} +span.wpcf7-form-control-wrap { + display: block; +} + +.contact-us .wpcf7-list-item{ + margin: 0; + width: 100%; + text-align: left; +} + +span.wpcf7-form-control-wrap input:not([type="checkbox"]):not([type="radio"]), +span.wpcf7-form-control-wrap select{ + display: block; + width: 100%; + border-radius: 4px; + padding: 9px 9px 9px 15px; +} + +span.wpcf7-form-control-wrap input[type="file"]{ + padding: 0; +} + +span.wpcf7-form-control-wrap input::placeholder { + color: #A0A0A0; +} + +span.wpcf7-form-control-wrap textarea { + color: #A0A0A0; + padding: 9px 9px 9px 15px; +} + +.contact-us form.wpcf7-form input[type="submit"] { + float: right; + margin-right: 0; +} +.pirate-forms-fields-container .form_field_wrap{ + text-align: left; +} + +.pirate-forms-file-upload-hidden.form-control { + height: auto; +} + +@media screen and (max-width: 767px) { + .pirate-forms-fields-container .form_field_wrap { + clear: both; + } +} + +.form-control { + height: auto; +} /*--------------------------------------- ** 5.0 Navigation ----- @@ -2475,12 +2540,18 @@ section#contact .pirate_forms .contact_checkbox_wrap p { } .pirate-forms-maps-custom { float: left; + text-align: left; } .contact-us .pirate-forms-maps-custom, .contact-us .contact_checkbox_wrap { color: #ffffff; } +.contact-us .pirate_forms .contact_checkbox_wrap, +.contact-us .pirateform_wrap_classes_spam_wrap { + text-align: left; +} + .zerif_hidden_if_not_customizer { display: none !important; } @@ -6670,10 +6741,6 @@ body.custom-background { .pirate-forms-g-recaptcha > div { display: inline-block; } - .pirate_forms .pirate-forms-submit-button { - display: inline-block; - text-align: center; - } .contact_submit_wrap { text-align: center; } @@ -6729,6 +6796,9 @@ body.custom-background { } } @media (max-width: 480px) { + .contact-us form.wpcf7-form input[type="submit"] { + width: 100%; + } /* HOME */ .intro { margin-top: 60%; diff --git a/template-frontpage.php b/template-frontpage.php index 303a729..5354b42 100644 --- a/template-frontpage.php +++ b/template-frontpage.php @@ -80,7 +80,8 @@ } /* CONTACT US */ - $zerif_contactus_show = get_theme_mod( 'zerif_contactus_show' ); + $zerif_contactus_show = get_theme_mod( 'zerif_contactus_show' ); + $zerif_alternative_contact_form = get_theme_mod( 'zerif_contactus_shortcode' ); if ( ( isset( $zerif_contactus_show ) && $zerif_contactus_show != 1 ) || is_customize_preview() ) : echo '
'; @@ -124,12 +125,14 @@ '; + echo do_shortcode( $zerif_alternative_contact_form ); + echo ''; + elseif ( defined( 'PIRATE_FORMS_VERSION' ) && shortcode_exists( 'pirate_forms' ) ) : echo '
'; echo do_shortcode( '[pirate_forms]' ); echo '
'; - endif; ?>