wp-deregister_scripts or styles in tags
-
How do I deregister collapse-o-matic in tags? The posts with tags are actually from category 2, but even though the post in category 2 are collapsing, when I go to the tag pages, they don’t work.
The following script is not working for tags.
// Load plugin only on pages that need it function my_deregister_styles() { if ( !is_category( '2' )) { wp_deregister_style('style-goes-here'); } } function my_deregister_javascript() { if ( !is_category( '2' )) { wp_deregister_script( 'collapse-o-matic' ); wp_deregister_script( 'collapseomatic-js' ); wp_deregister_script( 'collapse.js' ); wp_deregister_script( 'jquery-js' ); } if ( !is_tag()) { wp_deregister_script( 'collapse-o-matic' ); wp_deregister_script( 'collapseomatic-js' ); wp_deregister_script( 'collapse.js' ); wp_deregister_script( 'jquery-js' ); } if( !is_front_page( '1811' )) { wp_deregister_script('script-goes-here'); } } add_action('wp_print_styles', 'my_deregister_styles', 100); add_action('wp_print_scripts', 'my_deregister_javascript', 100);
I’m using tags in category 2 because I’m having (yet to be resolved!) issues with pagination in the archives of this category (yearly archive when selected won’t go to 2nd page of post year, goes to 2nd page of category archive).
If I remove the above script, then the plugin works fine (using wp 3.8.1), but it takes up too much load time and so I want it only to load in post where it’s needed.
Please help if you can. Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wp-deregister_scripts or styles in tags’ is closed to new replies.