Skip to content

Instantly share code, notes, and snippets.

@mintindeed
Created September 9, 2014 15:59
Show Gist options
  • Save mintindeed/a7d1e95f588970402086 to your computer and use it in GitHub Desktop.
Save mintindeed/a7d1e95f588970402086 to your computer and use it in GitHub Desktop.
Way for storyform to dequeue default scripts and provide a mechanism for themes and plugins to exclude scripts and styles from storyform pages
<?php
// Contains a list of script handles that Storyform wants to remove
// The defaults should be a list of WP core script handles that you know you don't want
// @see http://codex.wordpress.org/Function_Reference/wp_register_script#Handles_and_Their_Script_Paths_Registered_by_WordPress
$default_scripts_blacklist = array(
'jquery',
);
$scripts_blacklist = apply_filters( 'storyform-scripts-blacklist', $default_scripts_blacklist );
if ( $scripts_blacklist && is_array( $scripts_blacklist ) ) {
foreach ( $scripts_blacklist as $handle ) {
wp_dequeue_script( $handle );
}
}
// Contains a list of stylesheet handles that Storyform wants to remove
// There's no default list here
$default_styles_blacklist = array();
$styles_blacklist = apply_filters( 'storyform-styles-blacklist', $default_styles_blacklist );
if ( $styles_blacklist && is_array( $styles_blacklist ) ) {
foreach ( $styles_blacklist as $handle ) {
wp_dequeue_style( $handle );
}
}
//EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment