javascriptinstagraminstafeedjs

Can't figure out why my the Instagram pictures are not appearing with Instafeed?


I'm using Instafeed. I can't figure out why nothing is appearing on the website. I'm helping someone with their blog and they generated their access token.

This is the code I have. Everything is at the end of the body tag. I blocked out the Access Token and the User Id, I heard this info should be shared.

<div id='instafeed'></div>

<!-- jQuery library -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'/>

<!-- Latest compiled JavaScript -->
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'/>

<!-- Latest Instafeed -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/instafeed.js/1.4.1/instafeed.min.js'/>

<script type='text/javascript'>
    //<![CDATA[

    var feed = new Instafeed({
        get: 'user',
        userId: *********,
        limit:5,
        sortBy:'most-recent',
        accessToken:'*********************',
        template:'<li><a href='{{link}}' target='_blank'><img src='{{image}}'/><div class='insta-likes'><div style='display: table; vertical-align: middle; height: 100%; width: 100%;'><span style='display: table-cell; vertical-align: middle; height: 100%; width: 100%;'>{{likes}} <i class='fa fa-heart'/><br/>{{comments}} <i class='fa fa-comment'/></span></div></div></a></li>',
        resolution:'standard_resolution';
    });
    feed.run();
    //]]>
</script>


Solution

  • Avoid using single quotes inside and outside the same Javascript string.

    Try this with double quotes out, and single quotes in:

    var feed = new Instafeed({
        get: 'user',
        userId: *********,
        limit:5,
        sortBy:'most-recent',
        accessToken:'*********************',
        template:"<li><a href='{{link}}' target='_blank'><img src='{{image}}'/><div class='insta-likes'><div style='display: table; vertical-align: middle; height: 100%; width: 100%;'><span style='display: table-cell; vertical-align: middle; height: 100%; width: 100%;'>{{likes}} <i class='fa fa-heart'/><br/>{{comments}} <i class='fa fa-comment'/></span></div></div></a></li>",
        resolution:'standard_resolution';
    });
    feed.run();