Last active
September 17, 2015 15:50
-
-
Save donaldG/c647919f6be376ef8f0d to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Seems like this is the best way to remove Foobox where it's not needed. According to this blog post the js file name changes, | |
* but it seems like they've made it consistent. However, I couldn't seem to get the CSS to go away. | |
* http://blackhillswebworks.com/2013/03/13/load-foobox-plugin-scripts-and-styles-only-when-needed/ | |
* Foobox told me on Twitter to try using the 'Exclude Foobox' button on the page itself, but it didn't give me the results I wanted: | |
* https://twitter.com/foobox/status/595741740994297856 | |
* @don | |
*/ | |
add_action( 'wp_print_scripts', 'disable_foobox_script', 100 ); | |
function disable_foobox_script() { | |
if(is_front_page()){ | |
wp_dequeue_script( 'foobox-min' ); | |
} | |
} | |
add_action( 'wp_head', 'disable_foobox_footer_script' ); | |
function disable_foobox_footer_script() { | |
global $foobox; | |
if(is_front_page()){ | |
remove_action( 'wp_print_footer_scripts', array( $foobox, 'inline_dynamic_js' ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment