Support » Plugin: Smash Balloon Social Photo Feed » Limit Feed includes only on specific page that is actually used (homepage)

  • Resolved dimitrisv

    (@dimitrisv)


    Hello,
    we are using the feed only in our homepage. However, we noticed that the code/includes of the feed is included in each and every page of our site (even though there is no feed displayed); which is unnecessary, loads the pages, impacts speed etc.

    Is there a way to limit the includes on our homepage?

    A similar issue we had with Revolution Slider (which is rather heavy) but has the option to specify the page(s) where the includes (js and css) will be served.

    Thank you!

    Keep up the good work!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Smash Balloon Louis

    (@smashballoonlouis)

    Hi @dimitrisv,

    Thanks for contacting us! To prevent these files from loading on pages other than the home page, please add the following code snippet to the functions.php file of your active theme:

    add_action( 'wp_enqueue_scripts', 'remove_sbi_resources', 20 );
    function remove_sbi_resources() {
    	if( !is_front_page() ){
    	    wp_dequeue_style('sbi_styles');
    	    wp_deregister_script('sbi_scripts');
    	    wp_dequeue_script('sbi_scripts');
    	}
    }

    I hope this helps! Could you let me know if you have any questions?

    Thanks!

    Louis

    Thread Starter dimitrisv

    (@dimitrisv)

    Thank you so much Luis!

    I think you should add this type of functionality in the core of your plugin, as you already know in which pages the include is placed.

    Best regards,

    Dimitris.

    Plugin Support Smash Balloon Louis

    (@smashballoonlouis)

    Hi Dimitris,

    You’re very welcome, it was my pleasure to help! I’m glad to hear that worked for you. We appreciate the feedback, I will bring this up internally so we can discuss updates to this functionality.

    Thanks!

    Louis

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.