# How to: Instagram Feed without plugins

**URL:** <https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168>\
**Category:** How To\
**Created:** [October 28, 2021, 4:38am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168 "2021-10-28T04:38:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [October 28, 2021, 4:38am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/1 "2021-10-28T04:38:24Z")

</div>

Hello.

I am not a javascript master by any stretch of the imagination. “Hello World!” is as funky as I get.

I am looking to add an instagram feed on my website without plugins. Most of the plugins I’ve seen (smashballoon, etc.) add some bloat I’d like to avoid. Plus doing my own css stylings gives me more freedom.

I have been reading about Instafeed.js ([Instafeed.js - a simple Instagram javascript plugin](https://instafeedjs.com/#/)). My question is: how can I get this to work with Bricks?

P.S. Just a question for the devs, would it be possible (or even reasonable) to add instagram functionality to bricks like you did with facebook?

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [November 2, 2021, 11:00pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/2 "2021-11-02T23:00:23Z")

</div>

Hi Sergio,

the setup is pretty simple. By far the most difficult part is to generate the Instagram Access Token 😂

Follow these steps:

[https://github.com/stevenschobert/instafeed.js/wiki/Facebook-app-and-test-user-setup](https://github.com/stevenschobert/instafeed.js/wiki/Facebook-app-and-test-user-setup) [https://github.com/stevenschobert/instafeed.js/wiki/Managing-Access-Tokens](https://github.com/stevenschobert/instafeed.js/wiki/Managing-Access-Tokens)

You can skip the part with the token refresh for testing purposes, it will work for at least 60 days.

After you have generated your access token, copy the following code into a code element, paste your Access Token, and if everything works your images will appear [like mine](https://vimeo.com/641713854/d2005097c0).

```
<div id="instafeed"></div>

<script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>

<script type="text/javascript">
    var feed = new Instafeed({
      accessToken: 'your-access-token'
    });
    feed.run();
</script>

```

There are some [options](https://github.com/stevenschobert/instafeed.js/wiki/Options-Reference) as well as [custom templates](https://github.com/stevenschobert/instafeed.js/wiki/Templating) available, but you need to write at least some HTML and CSS to style your “feed” accordingly.

Best Regards,  
timmse

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 4, 2021, 4:24am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/3 "2021-11-04T04:24:01Z")

</div>

You are a Godsend! It works! I just used [Instant-Tokens.com || Instagram Access Tokens](https://www.instant-tokens.com/home) to pull the ‘InstagramToken’ and copy that into the accesstoken variable.

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [November 4, 2021, 1:06pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/4 "2021-11-04T13:06:30Z")

</div>

Hi Sergio,  
you’re welcome. Yeah Instant-Tokens are definitely the easier way to get the token than hiking through developers.facebook 👍

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 5, 2021, 1:12am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/5 "2021-11-05T01:12:43Z")

</div>

So you don’t actually have to create a fb app to get the token? You can just use [instant-tokens.com](http://instant-tokens.com) and then just paste the js code that Tim posted? I created an instant token and I added it on the code but instagram images don’t show up at all.

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 5, 2021, 3:28am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/6 "2021-11-05T03:28:57Z")

</div>

No. The instant-tokens page does it all for you. It has two options to pass that token on, the javascript and the json. I just copy/pasted the javascript url.

Here is how my page looks now:

```
<script src="the javascript url that instant-tokens gives you goes here"></script>

<!-- <script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>-->
<script type="text/javascript" src="https://myawesomewordpresspage.com/wp-content/plugins/instafeed/instafeed.js"></script>
 
<style>
  #instafeed {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: 1rem;
  grid-row-gap: 1rem;
  max-width: max-content;
  margin: auto;
}

#instafeed a {
  display: block;
}

#instafeed img {
  display: block;
  width: 100%;
  background-size: cover;
}
</style>

<div id="instafeed"></div>

<script>
  	console.log("Token: ", InstagramToken, Instafeed);
    var feed = new Instafeed({
      accessToken: String(InstagramToken),
      limit: 8
    });
    feed.run();
</script>
```

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 5, 2021, 3:31am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/7 "2021-11-05T03:31:11Z")

</div>

> [@Sergio](#):
>
> ```auto
> <script src="https://ig.instant-tokens.com/users/117b7e8f-4dac-4d48-81be-7323e717a806/instagram/17841421292392496/token.js?userSecret=mysupersecretkey"></script>
> 
> <!--<script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>-->
> <script type="text/javascript" src="https://myawesomewordpresspage.com/wp-content/plugins/instafeed/instafeed.js"></script>
>  
> <style>
> #instafeed {
> display: grid;
> grid-template-columns: repeat(4, 1fr);
> grid-column-gap: 1rem;
> grid-row-gap: 1rem;
> max-width: max-content;
> margin: auto;
> }
> 
> #instafeed a {
> display: block;
> }
> 
> #instafeed img {
> display: block;
> width: 100%;
> background-size: cover;
> }
> </style>
> 
> <div id="instafeed"></div>
> 
> <script>
> console.log("Token: ", InstagramToken, Instafeed);
> var feed = new Instafeed({
> accessToken: String(InstagramToken),
> limit: 8
> });
> feed.run();
> </script>
> 
> ```

Strange, I copy/pasted your above code and it still doesn’t work.

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 6, 2021, 1:16am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/8 "2021-11-06T01:16:14Z")

</div>

Alex,

That’s because you’ll need to A. change the [myawesomewordpresspage.com](http://myawesomewordpresspage.com) to your own page and upload the javascript there

OR

B. delete that line and uncomment the [unpkg.com](http://unpkg.com) line.

I uploaded the javascript because Lighthouse kept moaning about external scripts and whatnot. Might not even be worth the effort since it is such a small script.

Let me know if it works!

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 6, 2021, 1:51am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/9 "2021-11-06T01:51:49Z")

</div>

oh, got it! yes, I changed the url of the page but can you send me a link with the javascript code that I need to upload to wp-content/plugins/instafeed folder? I have some trouble locating the javascript code.

The B solution that you mentioned, you mean delete completely the line of code below? I don’t understand exactly what you mean by “uncomment”?

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 6, 2021, 3:15am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/10 "2021-11-06T03:15:46Z")

</div>

Hello Alex,

Uncomment simply means removing the “`<!--`” and “`-->`” characters from the line. And completely delete the other line.

`<!--<script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>-->`

Becomes

`<script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>`

And completely remove:  
`<script type="text/javascript" src="https://myawesomewordpresspage.com/wp-content/plugins/instafeed/instafeed.js"></script>`

This uses the script Stefan uploaded to unpkg site.

If you want to host the script locally, then simply create the file on your server and copy/paste the code from the github site: [https://github.com/stevenschobert/instafeed.js/blob/master/dist/instafeed.js](https://github.com/stevenschobert/instafeed.js/blob/master/dist/instafeed.js)

And then delete the unpkg line and change myawesomewebpage to your website and the folder you put the script in.

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 6, 2021, 2:35pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/11 "2021-11-06T14:35:32Z")

</div>

> [@Sergio](#):
>
> ```auto
> <script src="https://ig.instant-tokens.com/users/117b7e8f-4dac-4d48-81be-7323e717a806/instagram/17841421292392496/token.js?userSecret=mysupersecretkey"></script>
> 
> <!--<script type="text/javascript" src="https://unpkg.com/instafeed.js@2.0.0/dist/instafeed.js"></script>-->
> <script type="text/javascript" src="https://myawesomewordpresspage.com/wp-content/plugins/instafeed/instafeed.js"></script>
>  
> <style>
> #instafeed {
> display: grid;
> grid-template-columns: repeat(4, 1fr);
> grid-column-gap: 1rem;
> grid-row-gap: 1rem;
> max-width: max-content;
> margin: auto;
> }
> 
> #instafeed a {
> display: block;
> }
> 
> #instafeed img {
> display: block;
> width: 100%;
> background-size: cover;
> }
> </style>
> 
> <div id="instafeed"></div>
> 
> <script>
> console.log("Token: ", InstagramToken, Instafeed);
> var feed = new Instafeed({
> accessToken: String(InstagramToken),
> limit: 8
> });
> feed.run();
> </script>
> 
> ```

Yeah, success!! It worked now, you explained so clearly what I was doing wrong. Thank you so much, I can get rid of the smush feed instagram plugin and use this light code.

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 6, 2021, 6:07pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/12 "2021-11-06T18:07:22Z")

</div>

Is there a way to make the feed images show in random instead of chronological order? I clicked on the links with options and custom template but I couldn’t find that specific function. Also, when I check the page in google page speed, it says that Instagram images should have properly size images and serve them in next-gen formats. I already have a webp plugin for my other images on the website but it doesn’t serve insta images in webp also.

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 7, 2021, 11:30pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/13 "2021-11-07T23:30:38Z")

</div>

Hi Alex,

For that you’ll need to look at [https://github.com/stevenschobert/instafeed.js/wiki/Options-Reference](https://github.com/stevenschobert/instafeed.js/wiki/Options-Reference), especially the `sort` function and put it in your script code, perhaps after the `limit: 8` part (don’t forget to add a comma after 8 since you are passing multiple arguments).

As for PSI complaining about next gen stuff, I wouldn’t worry about it since it is an external image that you have zero control over. You can try to import the images into your local server and resize/compress them there, but you’ll have to do that custom coding yourself and quite frankly, that’s just too much of a headache if I were you.

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 8, 2021, 12:53am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/14 "2021-11-08T00:53:02Z")

</div>

Thanks but what value should I put on the sort function? value: random?

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [November 8, 2021, 1:23am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/15 "2021-11-08T01:23:06Z")

</div>

That I am not sure. Look at how Instagram passes arguments via their API and you should find some information there. The documentation for the instafeed is not very in depth.

---

<div class="post-metadata">

**Author:** ![alexgr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/a/779978/32.png) [@alexgr](https://forum.bricksbuilder.io/u/alexgr)\
**Post date:** [November 8, 2021, 2:17am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/16 "2021-11-08T02:17:51Z")

</div>

That’s strange. You’d think that would be something that would be clear on instafeed documentation.

---

<div class="post-metadata">

**Author:** ![Spipov](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@Spipov](https://forum.bricksbuilder.io/u/Spipov)\
**Post date:** [December 27, 2021, 10:12pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/18 "2021-12-27T22:12:28Z")

</div>

is that code still working? ive pasted the code (have gotten insta token already and used that link). ive also hosted the instafeed.js or used the direct link to the github, nothing appears to be rendering.

wanted to make sure this method still works before trying more

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [December 28, 2021, 12:46am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/19 "2021-12-28T00:46:51Z")

</div>

Still works for me. I have the script uploaded into a folder on my staging site and am calling that from the code block, pretty much how it is posted initially.

Check your console to see if there are any errors and let us know.

---

<div class="post-metadata">

**Author:** ![Alexson](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/alexson/32/2059_2.png) [@Alexson](https://forum.bricksbuilder.io/u/Alexson)\
**Post date:** [March 31, 2022, 5:28pm UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/20 "2022-03-31T17:28:47Z")

</div>

If you are looking to display your Instagram feed on a WordPress website, there are a couple of options.

You can get the Instagram feed plugin for WordPress or use the embedded Instagram widget.

I have tried both and here is the result:

Instagram widget looks ugly and restricts your creative freedom.

---

<div class="post-metadata">

**Author:** ![Sergio](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/sergio/32/567_2.png) [@Sergio](https://forum.bricksbuilder.io/u/Sergio)\
**Post date:** [April 4, 2022, 12:25am UTC](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168/21 "2022-04-04T00:25:17Z")

</div>

Hello Alexson,

Yes, you are correct. I am doing away with plugins and the widget is just…no.

Hence why that javascript works so well for me: it is fast and allows me to customize it via css with little problems.

[Next page](https://forum.bricksbuilder.io/t/how-to-instagram-feed-without-plugins/1168.md?page=2)
