Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Last active August 29, 2016 17:48
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 thomasplevy/d84a7ceb65c7d9f56b677d7ee824534c to your computer and use it in GitHub Desktop.
Save thomasplevy/d84a7ceb65c7d9f56b677d7ee824534c to your computer and use it in GitHub Desktop.
attempts to resolve various select2 conflicts LifterLMS has with other plugins / themes
<?php // don't include this line if pasting into an existing php file!
// late fire version of above...
/**
* Dequeue the 3.5.x version of Select2 JS library enqueued by ACF Pro
* This is only necessary on LifterLMS Quiz & Course Pages where LifterLMS
* requires version 4.x or higher to correctly function
*/
function maybe_dequeue_select2() {
$screen = get_current_screen();
if ( 'llms_quiz' === $screen->post_type || 'course' === $screen->post_type ) {
wp_dequeue_script( 'select2' );
}
}
add_action( 'admin_init', function() {
add_action( 'admin_enqueue_scripts', 'maybe_dequeue_select2', 777 );
} );
<?php // don't include this line if pasting into an existing php file!
/**
* Dequeue the 3.5.x version of Select2 JS library enqueued by ACF Pro
* This is only necessary on LifterLMS Quiz & Course Pages where LifterLMS
* requires version 4.x or higher to correctly function
*/
function maybe_dequeue_select2() {
$screen = get_current_screen();
if ( 'llms_quiz' === $screen->post_type || 'course' === $screen->post_type ) {
wp_dequeue_script( 'select2' );
}
}
add_action( 'admin_enqueue_scripts', 'maybe_dequeue_select2', 777 );
<?php // don't include this line if pasting into an existing php file!
/**
* Dequeue the 3.5.x version of Select2 JS library enqueued by the Rise Theme
* This is only necessary on LifterLMS Quiz & Course Pages where LifterLMS
* requires version 4.x or higher to correctly function
*/
function maybe_dequeue_thrive_select2() {
$screen = get_current_screen();
if ( 'llms_quiz' === $screen->post_type || 'course' === $screen->post_type ) {
wp_dequeue_script( 'thrive-select2' );
}
}
add_action( 'admin_enqueue_scripts', 'maybe_dequeue_thrive_select2', 777 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment