From b44e49476df312d051169744c6ea3ecc344ba7ae Mon Sep 17 00:00:00 2001 From: Cosmin S Date: Mon, 2 Jul 2018 18:05:26 +0300 Subject: [PATCH 1/3] shortcode functionality on contact us section #667 --- content-frontpage.php | 11 +++--- inc/customizer.php | 15 ++++++++ style.css | 81 +++++++++++++++++++++++++++++++++++++++--- template-frontpage.php | 9 +++-- 4 files changed, 104 insertions(+), 12 deletions(-) diff --git a/content-frontpage.php b/content-frontpage.php index 29c48bc..127ab01 100644 --- a/content-frontpage.php +++ b/content-frontpage.php @@ -80,6 +80,7 @@ /* CONTACT US */ $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/inc/customizer.php b/inc/customizer.php index 8093666..f39b26e 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' ), + 'description' => __( 'Or add the shortcode of your choice here.', 'zerif' ), + 'section' => 'zerif_contactus_section', + 'priority' => 2, + ) + ); + /* Contactus email */ $wp_customize->add_setting( 'zerif_contactus_email', array( diff --git a/style.css b/style.css index 2da9a9a..af24dad 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,11 +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 .pirate-forms-maps-custom, +.contact-us .pirate_forms .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; } @@ -6669,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; } @@ -6728,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..66c74ec 100644 --- a/template-frontpage.php +++ b/template-frontpage.php @@ -81,6 +81,7 @@ /* CONTACT US */ $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; ?> From 9586e76281fe164b5d6b777725975cd6568dbc08 Mon Sep 17 00:00:00 2001 From: Cosmin S Date: Mon, 2 Jul 2018 18:16:21 +0300 Subject: [PATCH 2/3] fix grunt --- content-frontpage.php | 2 +- inc/customizer.php | 4 ++-- template-frontpage.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content-frontpage.php b/content-frontpage.php index 127ab01..602f819 100644 --- a/content-frontpage.php +++ b/content-frontpage.php @@ -79,7 +79,7 @@ } /* 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() ) : diff --git a/inc/customizer.php b/inc/customizer.php index f39b26e..6659ce2 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -2279,8 +2279,8 @@ function zerif_blog_header_title_subtitle_callback() { ); $wp_customize->add_control( 'zerif_contactus_shortcode', array( - 'label' => __( 'Contact Form Shortcode', 'zerif' ), - 'description' => __( 'Or add the shortcode of your choice here.', 'zerif' ), + 'label' => __( 'Contact Form Shortcode', 'zerif-lite' ), + 'description' => __( 'Or add the shortcode of your choice here.', 'zerif-lite' ), 'section' => 'zerif_contactus_section', 'priority' => 2, ) diff --git a/template-frontpage.php b/template-frontpage.php index 66c74ec..5354b42 100644 --- a/template-frontpage.php +++ b/template-frontpage.php @@ -80,7 +80,7 @@ } /* 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() ) : From c91f6597772419bbcb11a658c3721409f4b1f31c Mon Sep 17 00:00:00 2001 From: Cosmin S Date: Tue, 17 Jul 2018 15:29:53 +0300 Subject: [PATCH 3/3] woocommerce image sizes compatibility #669 --- functions.php | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) 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 */