Client Background & Requirements
- Our client wanted a customized Instagram widget for their website that allows visitors to get a glimpse of the company’s events, people, and culture.
- The Instagram widget should pull the latest photos from their company page periodically, show it in an infinity slider fashion and allow admin to configure widget settings from the back-end.
How did we provide solution?
We worked on the project as follows:
- We did a custom API integration with Instagram that fetches the last 12 photos and updates them on the site periodically.
- We developed it as a theme widget that can be added to pages, posts, and custom post types.
- We provided a Settings page in the back-end from which access token and other settings like no of photos, background color, will be accepted.
- For making periodic API calls, we used an action scheduler library that allows for a job queue that can be processed in the back-end and is more reliable than WordPress’s default cron job.
- When the API call is made and if there is a new update, new images are stored in the WordPress media library and then shown on a carousel widget.
- After fetching the new images, the old images are discarded from the media library automatically to avoid clutter in the media library.
Screenshot: Instagram Feed in Action