diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f93616..a7d6476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Better Gravity Forms compatibility with bootstrap-datepicker + ### 0.7.7: May 25th, 2021 * Bootstrap select rules for Gravity Forms are conflicting on mobile diff --git a/inc/front/scripts.php b/inc/front/scripts.php index 0c212bf..f7aa602 100644 --- a/inc/front/scripts.php +++ b/inc/front/scripts.php @@ -128,6 +128,13 @@ function stormbringer_js_libraries_footer() { if ( @$libraries['bootstrap-datepicker'] && get_theme_mod( 'libraries_bootstrap-datepicker', true ) ) { + wp_dequeue_script( 'gform_datepicker_init' ); + wp_dequeue_script( 'gform-datepicker-init' ); + wp_dequeue_script( 'jquery-ui-datepicker' ); + wp_deregister_script( 'gform_datepicker_init' ); + wp_deregister_script( 'gform-datepicker-init' ); + wp_deregister_script( 'jquery-ui-datepicker' ); + $lang_datepicker = ($lang == 'zh' ? 'zh-CN' : $lang); wp_enqueue_script( 'bootstrap-datepicker', diff --git a/inc/plugins/gravityforms.php b/inc/plugins/gravityforms.php index a8631f4..835e371 100644 --- a/inc/plugins/gravityforms.php +++ b/inc/plugins/gravityforms.php @@ -347,11 +347,13 @@ function stormbringer_gform_get_form_filter($content) //$content = preg_replace('/', '', $content ); + $content = str_replace( 'hasDatepicker', '', $content ); + $content = str_replace( 'datepicker_no_icon', '', $content ); + $content = str_replace( 'datepicker', '', $content ); return $content; }