Hey lancegputnam,
I just put together a snippet for you which should do this, add it to the plugin’s Custom JavaScript section and let me know whether it works:
$('#sb_instagram').each(function(){
$(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + $(this).find('.sbi_header_text h3').text() );
});
I hope you’re having a good start to your week!
John
Thanks for the quick reply! So it does take me into the Instagram application, but it is unable to locate the user because it adds the @ symbol before the user id. So when I click the header, it takes me into app and says user not found. For instance, the header says @lancegputnam and it tries to pull up @lancegputnam in the application and not lancegputnam. Is there a way to remove the @ symbol in the script or just remove the @ symbol in the header? Thanks again!
No probs, try this instead:
$('#sb_instagram').each(function(){
var username = $(this).find('.sbi_header_text h3').text();
if( username .charAt(0) === '@' ) username = username.substr(1);
$(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + username );
});
Lemme know if it does the trick!
John
Oops, there isn’t supposed to be a space after ‘username’ at the start of the 3rd line. It should be:
$('#sb_instagram').each(function(){
var username = $(this).find('.sbi_header_text h3').text();
if( username.charAt(0) === '@' ) username = username.substr(1);
$(this).find('.sbi_header_link').attr('href', 'instagram://user?username=' + username );
});
John
Thanks so much, that works!
Woop woop 🙂 Glad to hear that and thanks for the great review, I really appreciate that.
Just let me know if you have any other questions and enjoy the rest of your week.
John