• Help Center
  • Instagram feed InstaShow doesn’t load on ajax-powered WordPress websites

Instagram feed InstaShow doesn’t load on ajax-powered WordPress websites

Share
Customers with ajax-powered WordPress websites have sometimes complained of a plugin loading issue. The gist of the issue is that when you visit a page without the plugin, and then go to the page with the plugin, the plugin doesn’t load until you refresh the page.

Ajax functionality can occasionally cause issues with our plugin’s work. Fortunately, we have a pretty universal solution, that should help you fix them regardless of your website’s theme. might.

First, you need to go to Preferences page and enable the option “Add plugin script to every page”. Next, add the following code to Custom JS field:

jQuery(function($) {
    var observer;
    
    if (window.MutationObserver && !observer) {
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(m) {
                if (!m.addedNodes || !m.addedNodes.length) {
                    return;
                }

                Array.prototype.slice.call(m.addedNodes).forEach(function(el) {
                    if ($(el).find('[data-elfsight-instagram-feed-options]').length) {
                        
                        jQuery('[data-elfsight-instagram-feed-options]').each(function(){
                            var settings = JSON.parse(decodeURIComponent(jQuery(this).attr('data-elfsight-instagram-feed-options')));
                            
                            jQuery(this).eappsInstagramFeed(settings)
                        })

                        window.dispatchEvent(new Event('resize'));
                    }
                });
            });
        });

        observer.observe($('body').get(0), {
            childList: true,
            subtree: true
        }); 
    }
});

Press Save, and check your plugin again. In case the solution doesn’t help, please, start a conversation at our Support Center, and we’ll do the best we can to help you!

Still got questions?

If you need any further assistance, contact our very helpful Support Center and we'll be happy to answer any questions. Just expect a response during our working hours (from 10 a.m. to 7 p.m. CET, Monday through Friday).