I really like the plugin called Seriously Simple Podcasting. It does a good job and is easy to use. One thing I don’t like about it is that it loads a lot of styles and scripts into other posts and pages that don’t need them.
If you’d like to remove the styles and scripts from the SSP plugin, here’s how:
In your theme there is a file called functions.php
. Place this code at the bottom of that file. If there is a closing ?>
then place this code just above that.
add_action( 'wp_enqueue_scripts', 'podcast_conditional_loading', 11 ); function podcast_conditional_loading(){ if( 'podcast' != get_post_type() ) { wp_dequeue_script( 'ssp-block-wavesurfer' ); wp_dequeue_script( 'ssp-block-media-player' ); wp_dequeue_script( 'ssp-block-html5-player' ); wp_dequeue_style( 'ssp-block-style' ); wp_dequeue_style( 'ssp-block-fonts-style' ); wp_dequeue_style( 'ssp-block-gizmo-fonts-style' ); wp_dequeue_style( 'ssp-frontend-player'); } }
That should do it. For any other plugin you can do the same thing. You just have to find the names of the styles and/or scripts by searching in the plugin code for the strings:
wp_enqueue_style
or wp_enqueue_script
These will be followed with the names you will want to dequeue. You will also want to change the if condition from if( 'podcast' != get_post_type() ) { ... }
to something else or remove it completely to dequeue the styles and scripts on every page.