Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Only load Genesis Responsive Slider resources on pages that use them?

$
0
0

Replies: 0

Hi there,

Does anyone know of a copy/paste code snippet to be able to stop this plugin’s resources (js & CSS) from loading on every page of a site it’s installed on? Such as by naming IDs or page slugs for it to be loaded on?

I’m not much of a coder and also am not sure how to find the naming system to use by following instructions from other code snippets online that do this for other plugins.

For example, I use the code below in functions.php to remove Contact Form 7 scripts from pages not using them:

/**
 * Remove Contact Form 7 scripts + styles unless we're on the contact page
 *
 */
add_action( 'wp_enqueue_scripts', 'ac_remove_cf7_scripts' );

function ac_remove_cf7_scripts() {
	if ( !is_page('id-or-slug-goes-here') ) {
		wp_deregister_style( 'contact-form-7' );
		wp_deregister_script( 'contact-form-7' );
	}
}

How can I achieve that with the Genesis responsive slider? I don’t know what to replace “contact-form-7” with above. Or if the above would work…

Your help would be very much appreciated.

I also posted this on the Genesis forums here: http://www.studiopress.com/forums/topic/only-load-genesis-responsive-slider-resources-on-pages-that-use-them/

After I did that I had a ‘duh’ moment that I should be posting this here. I can update both forums once an answer comes through. Hopefully it can help more folks.


Viewing all articles
Browse latest Browse all 59525

Trending Articles