• Resolved getupworks

    (@getupworks)


    thanks for providing this great plugin!

    i need my instagram feed on a specific page only and would like to reduce loading times everywhere else on the site.
    so, is there a way to enqueue the plugins styles and scripts on this page only?
    something like
    if ! is_page('123') { remove / dequeue }
    ?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey getupworks,

    Try this PHP:

    add_action( 'wp_enqueue_scripts', 'sb_instagram_dequeue', 11 );
    function sb_instagram_dequeue() {
    	if ( ! is_page('123' ) ) {
    		wp_dequeue_style( 'sb_instagram_styles' );
    		wp_dequeue_script( 'sb_instagram_scripts' );
    		wp_dequeue_style('sb-font-awesome');
        }
    }

    Let me know if you have more questions!

    – Craig

    Thread Starter getupworks

    (@getupworks)

    hey @craig-at-smash-balloon
    perfect, thank you!
    i ended up with this:

    add_action( 'wp_enqueue_scripts', 'sb_instagram_dequeue', 11 );
    function sb_instagram_dequeue() {
    	if ( ! is_page('123' ) ) {
    		wp_dequeue_style( 'sb_instagram_styles' );
    		wp_dequeue_script( 'sb_instagram_scripts' );
    		remove_action( 'wp_head', 'sb_instagram_custom_css' ); // remove inline style
    		// wp_dequeue_style('sb-font-awesome'); deactivated in plugins options
        }
    }
    Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Awesome! Thanks for sharing I’m sure someone else will find it valuable as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Load plugin styles + scripts on specific page only’ is closed to new replies.