only load Fancy Box js code & css on one page?
-
Hello,
I am only using Fancy Box on one page – but all of the script & css code is being loaded on every page – which is a waste of bandwidth. Is there an easy way to modify this plugin to only load on one page, or only load on certain types of posts/pages, etc.?
in other thread, you posted this code to add to functions.php:
add_action('wp_head','my_conditional_script',0); function my_conditional_script() { if (is_index() || is_front_page() || is_home()) { remove_action('init','easy_fancybox_init'); remove_action('wp_print_styles', 'easy_fancybox_enqueue_styles', 999); remove_action('wp_enqueue_scripts', 'easy_fancybox_enqueue_scripts', 999); remove_action('wp_head', 'easy_fancybox', 999); } }
But that didn’t change anything for me on my twentytwelve based WP 4.0 site.
Thanks,
Devin
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘only load Fancy Box js code & css on one page?’ is closed to new replies.