Skip to content

Instantly share code, notes, and snippets.

@webaware
Last active July 9, 2018 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webaware/f7c8ba642b7a12a1ea8c74277e5af084 to your computer and use it in GitHub Desktop.
Save webaware/f7c8ba642b7a12a1ea8c74277e5af084 to your computer and use it in GitHub Desktop.
Stop Event Tickets from breaking WooCommerce product pages with an old select2 script
<?php
/*
Plugin Name: Fix Events vs WooCommerce select2
Plugin URI: https://gist.github.com/webaware/f7c8ba642b7a12a1ea8c74277e5af084
Description: Stop Event Tickets and The Events Calendar from breaking WooCommerce product pages with an old select2 script
Version: 1.2
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
/*
copyright (c) 2018 WebAware Pty Ltd (email : support@webaware.com.au)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if (!defined('ABSPATH')) {
exit;
}
add_action('admin_print_styles-post.php', 'event_tickets_woo_select2_fix', 1);
add_action('admin_print_styles-post-new.php', 'event_tickets_woo_select2_fix', 1);
function event_tickets_woo_select2_fix() {
// only with WooCommerce and The Events Calendar or Event Tickets running
if (!(function_exists('WC') && (defined('TRIBE_EVENTS_FILE') || defined('EVENT_TICKETS_DIR')))) {
return;
}
// only if not a The Events Calendar / Tickets custom post type
global $typenow;
if (strpos($typenow, 'tribe_') === 0) {
return;
}
wp_dequeue_script('tribe-select2');
wp_deregister_script('tribe-select2');
wp_dequeue_style('tribe-select2-css');
wp_deregister_style('tribe-select2-css');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment