George Whitcher

Dad, Web Developer, Software Engineer, Graphic Artist, Snowboarder, Musician, Gamer, Nerd

GW-IG-Feed

GW-IG-Feed

Posted in PHP, Wordpress
December 1, 2016 07:09:59 PM
Published by
Leave your thoughts

GW-IG-Feed is an Instagram plugin made for my personal use.  I like to show my latest photos on my website but don’t like to upload in multiple locations.  I share most of my fun pics on Instagram so it made sense to just hook into the API and display my images on my website automatically.  This was not much work as I did all the hard work on a previous project Instagram Photo Ripper.  So it was mostly just integrating it into a WordPress plugin.  I just upgraded it to use json rather than CURL.

Instagram has put restrictions in place to only allow up to 20 items on a feed for an app in sandbox mode.   I can only assume they were getting way to many API calls couldn’t handle it.  To get out of sandbox mode you have to fall into certain categories which GW-IG-Feed does not.  So I plan on working with Instagram on getting this out of sandbox mode so a full feed can be displayed.

You can now install GW-IG-Feed directly from the WordPress plugins directory.  Alternatively you can download directly from the repository.  Download and extract the contents in your plugins folder.  Login to WordPress and activate the plugin.  Visit the GW-IG-Feed settings page and click “Sign in with Instagram”.  Then add your username and a count (current max 20 limited by API).  You also have the option of integrating Bootstrap 3 or not.  If you have this natively in your theme it is best to leave this disabled.

That’s it! You are all set! You can use the shortcode to display your feed by placing [“GW-IG-Feed”] (without quotes) in any page or you can use PHP in one of your theme files.

$instagramgw = new InstagramGW();
$instagramgw->instagram_gw_shortcode();

OR (to design your own (see administration.php for example))

$instagramgw = new InstagramGW();
$instaData = $instagramgw->instagram_gw_init();
foreach ($instaData->data as $instaPost) {
    echo '<a href="'.$instaPost->images->standard_resolution->url.'" target="blank">';
    echo '<img src="'.$instaPost->images->low_resolution->url.'" alt="'.$instaPost->caption->text.'" />';
    echo htmlentities($instaPost->caption->text).' | '.htmlentities(date("F j, Y, g:i a", $instaPost->caption->created_time));
    echo '</a>';
}

Github: https://github.com/gwhitcher/GW-IG-Feed
WordPress: https://wordpress.org/plugins/gw-ig-feed

Article written by:

Hi! My name is George Whitcher and I am a developer from the South Shore of MA.  When I am not busy being a dad I like to play video games, play/write music, snowboard, and skateboard.