Last active
December 5, 2016 22:42
-
-
Save Pebblo/026e24996b32db5590128c86425d685e to your computer and use it in GitHub Desktop.
An example of how to remove scripts from the EE Event/Venue pages. Currently this removes the Januas 'cmb-scripts' script file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Do not include the opneing PHP tag if you already have one. | |
//This functions can be used to remove scripts loaded by other plugins (or the sites theme) on EE Event/Venue pages. | |
function tw_ee_remove_scripts_from_event_editor( $hook_suffux ){ | |
$page = isset( $_GET['page'] ) ? $_GET['page'] : ''; | |
$action = isset( $_GET['action'] ) ? $_GET['action'] : ''; | |
if ( ( $hook_suffux == 'post.php' || $hook_suffux == 'post-new.php' ) && ( $page == 'espresso_events' || $page == 'espresso_venues' ) && ( $action == 'edit' || $action == 'create_new' ) ) { | |
//This is an EE Event/Venue page, add scripts to remove in thi block | |
wp_deregister_script( 'cmb-scripts' ); | |
} | |
} | |
add_filter( 'admin_enqueue_scripts', 'tw_ee_remove_scripts_from_event_editor', 20, 1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Do not include the opneing PHP tag if you already have one. | |
//@JoshFeck used a different method in the forum thread which completely removes the action added by Januas theme: | |
function tw_ee_remove_scripts_from_event_editor(){ | |
remove_action( 'admin_enqueue_scripts', 'cmb_scripts', 10 ); | |
} | |
add_action( 'add_meta_boxes_espresso_events', 'tw_ee_remove_scripts_from_event_editor' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference:
https://eventespresso.com/topic/unable-to-open-event-calendars-after-ee-4-9-22-update/