I need to dequeue or remove style and script related to "pretty_photo" from my theme but load it again only when it called or needed
i have this code in my functions.php
wp_enqueue_style('pretty_photo',
MASTER_THEME_DIR . '/addons/prettyphoto/prettyPhoto.css',
array(), false, 'all');
please someone help me.
Thank you!
I get it to work finally .. The code is:
add_action( 'wp_enqueue_scripts', 'pretty_photo_styles', 100 ); function pretty_photo_styles() { if ( ! is_single() ) { wp_dequeue_script( 'pretty_photo' ); wp_dequeue_style( 'pretty_photo' ); }}
Please someone correct it if i missed anything! i tried it and it worked for me.
Thank you all.