wordpressinstagramfeedinstafeedjs

Instafeed not display feeds


I am using http://instafeedjs.com/ to display Instagram feed in my WordPress site.

I have included this file:

<script type="text/javascript" src="path/to/instafeed.min.js"></script> 

<script type="text/javascript">
var feed = new Instafeed({
    get: 'tagged',
    tagName: 'awesome',
    clientId: 'YOUR_CLIENT_ID'
});
feed.run();

and added into the page <div id="instafeed"></div>. But this displays

ReferenceError: Instafeed is not defined

error in the Firebug, and the feed not displays.

Does anyone know solutions to fix this?


Solution

  • Try to wrapp your code in some delay function, like this:

    <script type="text/javascript">
       jQuery(document).ready(function(){
          var feed = new Instafeed({
          get: 'tagged',
          tagName: 'awesome',
          clientId: 'YOUR_CLIENT_ID'
          });
    
         feed.run();
       });
    </script>
    

    You called your in‌​stafeed.min.js after your code, thats why you get Not Defined error.

    Another solution will be to call in‌​stafeed.min.js file before your code in Dom: in header, in body, up to your code. In this case you can use your code without wrapping in delay functions