Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active February 6, 2018 20:59
Show Gist options
  • Save barryhughes/803efa9b4714edcaaac9ac736b1bc105 to your computer and use it in GitHub Desktop.
Save barryhughes/803efa9b4714edcaaac9ac736b1bc105 to your computer and use it in GitHub Desktop.
Can be used to resolve a conflict caused by ECP and Avada adding two different versions of the same library (Isotope)
<?php
/**
* Temporary fix for an Isotope conflict between Events Calendar PRO
* and Avada, when the [tribe_events] shortcode is used to embed
* photo view.
*
* Tested with Events Calendar PRO 4.4.19
* and Avada 5.3.0.
*/
add_action( 'tribe_events_pro_tribe_events_shortcode_prepare_photo', function() {
// Dequeue ECP's copy of isotope
wp_dequeue_script( 'tribe-events-pro-isotope' );
// Dequeue and deregister ECP's photo view JS
wp_dequeue_script( 'tribe-events-pro-photo' );
wp_deregister_script( 'tribe-events-pro-photo' );
// Re-enqueue photo view JS, but without tribe-events-pro-isotope as a dependency
$photoview_path = Tribe__Events__Template_Factory::getMinFile( tribe_events_pro_resource_url( 'tribe-events-photo-view.js' ), true );
wp_enqueue_script( 'tribe-events-pro-photo', $photoview_path, array(), false, true );
}, 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment