Add instagram feed to page from URL
🚧 Edit - As of 13th April 2021 - This code does not work. Solution is being looked into, however due to time constraints from client work, this may be a bit of time until I am able to look at trying to fix this.
Feel free to have a go at fixing it. Make a pull request if you find a solution.
Watch the demo and tutorial from Jonathan at Permaslug
Using Wordpress
- Add index.php to code snippets or functions.php
- Replace
$insta_id
with Instagram username - Add shortcode to page
For slider integration
- Add slider CSS to head of website
- Add slider JS just before closing
</body>
tag - Add the
<script>
and<styles>
code to functions.php or code snippets
[instafeed user="ATTRIBUTE_NAME"]
To use grid = [instafeed user="feed-grid"] To use slider = [instafeed user="feed-slider"]
You can pass extra parameters to the grid and slider:
caption=true
- shows the caption (Default is false)class="my-custom-class"
- this adds a custom class to the grid or slider so you can target specific sliders if more than 1 on the pagepost_count="6"
- returns 6 in the slider or grid (Default is 12)
feed-grid
- User feed gridfeed-slider
- User feed sliderusername
- Users usernamename
- Users display nameuser_pp
- Users profile picture thumbnailuser_pp_hd
- Users profile picture HDfollowers
- Users follower countfollowing
- Users following countbio
- Users biouser_post_count
- Total number of users posts
[instafeed user="feed-grid" caption=true post_count=6]
[instafeed user="feed-slider"]
-
To see what other data is available, use - https://www.instagram.com/{username}/channel/?__a=1
-
You can change the length of the transient (cache) by changing line 19
86400
to a different time (in seconds). Default is 1 day.604800
= 1 week86400
= 1 day3600
= 1 hour
-
The default instagram feed does not come with any styling.
-
Feel free to make a pull request if you come up with a nice design and share it with the community
If the instagram feed is showing the wrong user, this is usually down to the transients showing a cached version.
To fix this, pleaase use these steps:
- Uncomment lines
8
and20
in index.php - Load the frontend where the shortcode appears
- Re-comment lines
8
and20
If you found this useful,and would like to support me. You can use my buyMeACoffee link below.
Please note: it is NOT required. It is here for you to enjoy either way.