A Wordpress shortcode that outputs a user's latest images.
- Requests are cached as transients for 1 hour.
- Template function is overrideable for each shortcode instance.
- Uses http://instagram.com/developer/endpoints/users/#get_users_media_recent
[simple-instagram-feed user="000000000" token="000000000.0000000.00000000000000000000000000000000" count="20" template_func="my_bootstrap_instagram_output"]
user
: The numerical ID of the user whose images are being requestedtoken
: The client-side auth token you generatedcount
: Number of images to get. Default is 10.template_func
: Name of custom function to use for image output. Default output is<img />
tags wrapped in<a>
s.
<?php
function my_bootstrap_instagram_output($pics) {
ob_start();
if (count($pics) > 0) { ?>
<div id="instagram-box" class="row">
<?php foreach ($pics as $pic) { ?>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<a href="<?php echo esc_url($pic->link) ?>" title="<?php echo esc_attr($pic->caption->text) ?>">
<img src="<?php echo esc_url($pic->images->thumbnail->url) ?>" class="img-responsive" />
</a>
</div>
<?php } ?>
</div>
<?php }
return ob_get_clean();
}
?>
- Doesn't support
min_timestamp
,max_timestamp
,min_id
ormax_id
.