Link Instagram photos to custom URLs

By default, the photos in the Instagram Feed will link to the photos on Instagram, however, you can use a custom code snippet to link each photo to a unique URL of your choosing.

There are two methods to do this. You can manually change each link, or if you can add the full url to the caption of your Instagram posts (on instagram.com), you can automatically make that post link to the page in the caption.

 

Manual Method

First, you need to find the ID of each photo. You can do this by right clicking on the photo, clicking “Inspect Element” and then making copying the ID attribute (screenshot). It will look similar to this: sbi_1253736523657580376_10145706.

In the Pro version you can also find the ID by viewing your feed, clicking on the photo to launch the popup lightbox, and then clicking on the ‘Hide Photos (admin)’ link.

You can then use a JavaScript snippet to change the link on each photo, like so:

$('#sbi_1253736523657580376_10145706').find('.sbi_photo').attr('href', 'https://yourlink1.com');
$('#sbi_1253665037575982435_10145706').find('.sbi_photo').attr('href', 'https://yourlink2.com');
$('#sbi_1248694870995570598_10145706').find('.sbi_photo').attr('href', 'https://yourlink3.com');

You can add these to the plugin’s Custom JavaScript section on the Customize page.

 

Full Link URL in Caption Method

Note: This feature is only available in the “Pro” version.

We’ve added a feature to the Pro version of the plugin to make linking your posts to custom URLs really easy and painless. Simply add the URL you’d like to link the post to in the caption of the post on Instagram. Then enable the following setting in our plugin: Instagram Feed > Customize > Link posts to URL to caption. For more detailed directions on creating a shoppable feed, please see this article.