This repository is no longer actively maintained. The plugin still works, but does not receive any further updates other than community contributed fixes. |
---|
WordPress plugin to get latest images from Instagram user feeds.
Basically this plugin fetches images from Instagram, saves those to transient and next requests will be served from there. After transient has expired and deleted, new fetch from Instagram will be made and saved to transient. This implements very simple cache.
Handcrafted with love at Digitoimisto Dude Oy, a Finnish boutique digital agency in the center of Jyväskylä.
DEPRECATED! This plugin does not work so well after Instagram has tightened their API usage. Better plugin to use is ig-graph-feed by Jake Peterson or our image-user-feed which bypass the official API.
- Please note before using
- License
- Legal
- Usage
- Usage example for displaying user feed
- Limiting feed items
- Hooks
- Composer
- Contributing
This plugin is not meant to be "plugin for everyone", it needs at least some basic knowledge about php and css to add it to your site and making it look beautiful.
This is a plugin in development for now, so it may update very often.
Dude insta feed is released under the GNU GPL 2 or later.
Please read Instagram's TOC to determine can you use images and what restrictions there may be.
This plugin does not have settings page or provide anything visible on front-end. So it's basically dumb plugin if you don't use any filters listed below.
Only mandatory filter to use is dude-insta-feed/access_token/user=$userid
.
Get images by calling function dude_insta_feed()->get_user_images()
, pass user id as a only argument. User's id can be obtained with this tool.
- Go to instagram.com/developer and register an application for your WordPress site. Please note that application must be registered with that exact user account you want to pull images from!
- Disable Implicit oAuth2 from security for next step to work.
- Generate access token by going to this url and adding your CLIENT ID and REDIRECT URIs to their appropriate places and click Authorize.
- Enable Implicit oAuth2 back.
- Get the code after
#access_token=
in the following URL and add this snippet to functions.php. Your user ID is in the beginning of access token, just before tge dot.
/**
* Dude Instagram hashtag feed.
*/
add_filter( 'dude-insta-feed/access_token/user=USERID_HERE', function() { return 'ACCESS_TOKEN_HERE'; } );
- Add this loop to wherever you want to display your images:
<?php
$instagram_feed = dude_insta_feed()->get_user_images( 'USERID_HERE' );
foreach ($instagram_feed['data'] as $item) : ?>
<img src="<?php echo $item['images']['standard_resolution']['url']; ?>" alt="" />
<?php endforeach; ?>
/**
* Limit Instagram feed items
*/
add_filter( 'dude-insta-feed/user_images_parameters', function( $parameters ) {
$parameters['count'] = '6';
return $parameters;
} );
All the settings are set with filters, and there is also few filters to change basic functionality and manipulate data before caching.
Because Instagram's API restrictions, every user needs their own access token. Access token can be generated following this instruction.
Set the access token for specific user. Passed arguments are default access_token and user id.
Defaults to empty string.
Change name of the transient for user images, must be unique for every user. Passed arguments are default name and user id.
Defaults to dude-insta-user-$userid
.
Modify api call parameters, example count of images. Only passed argument is array of default parameters.
Defaults to access_token defined for user and image count of five.
Manipulate or use data before it's cached to transient. Only passed argument is array of images.
Change image cache lifetime. Only passed argument is default lifetime in seconds.
Defaults to 600 (= ten minutes).
To use with composer, run composer require digitoimistodude/dude-insta-feed dev-master
in your project directory or add "digitoimistodude/dude-insta-feed":"dev-master"
to your composer.json require.
If you have ideas about the plugin or spot an issue, please let us know. Before contributing ideas or reporting an issue about "missing" features or things regarding to the nature of that matter, please read Please note section. Thank you very much.