• Hello,

    I found some conflicts with the plugin date picker js with the other event plugins. Usually, events plugin has had expiry date feature so post expires is not usable but then creating conflicts.

    So I found a simple solution by loading your plugin’s scripts just to the specified post types in the setting.

    Below code is the fix for my issue. Please let me know if it is the right way or there is any other better way to fix the conflict.

    /****************************************************************
     * CUSTOM EDITS
     * EDITED BY JATIN SONI <https://jatinsoni.rocks>
     * PURPOSE: AVOID CONFLICT WITH THE EVENT PLUGINS DATEPICKER
     ****************************************************************/
    // get the current post type
    $screen = get_current_screen();
    
    // get all keys
    // this foreach is required as '$this->settings[ 'post_types' ]' is associative array
    // post_type => bool
    // [post => 1, page => 1, alert => 1, ...]
    foreach ( $this->settings[ 'post_types' ] as $key => $value ) {
        $post_type[] = $key;
    }
    
    // enqueue scripts and styles only for the set post types in settings
    if ( in_array( $screen->post_type, $post_type ) ) {
    
        wp_enqueue_style( 'dtpicker-css', $this->url_assets . 'css/datepicker.min.css' );
    
        wp_enqueue_script( 'xn-wppe-plugin-js', $this->url_assets . 'js/plugin-scripts.js', [ 'dtpicker-js' ] );
        wp_enqueue_script( 'dtpicker-js', $this->url_assets . 'js/datepicker.min.js', [ 'jquery' ] );
        if ( $dtplang != FALSE ) {
            wp_enqueue_script( 'dtpicker-lang-js', $this->url_assets . 'js/i18n/datepicker.' . $dtplang . '.js', [
                'jquery',
                'dtpicker-js'
            ] );
        }
    } // FINISHED CUSTOM EDITS
    • This topic was modified 7 years, 6 months ago by pixelandgrain. Reason: Modified code
  • The topic ‘[Fix] Conflicting datepicer wtih other events plugin’ is closed to new replies.