About
You can use the template tags to access Instagram data and plugin data in your title, content, excerpt, and custom meta fields for an account. This allows your to combine tags with text and HTML to have complete control over the output of the plugin.
Tags will not work in the account post titles for multiple images in the same post.
Only some tags can be used in the title and custom meta fields but they can be combined with normal text as well.
The tags can be used in the main content in any combination along with HTML markup.
The Tags
image
Usage: %%image%%
The image url, either direct from Instagram or from the WP media library.
Note: Cannot be used in the Title
video
Usage: %%video%%
The video url, either direct from Instagram or from the WP media library.
Note: Cannot be used in the Title
caption
Usage: %%caption%%
The image caption from Instagram including tags.
caption-escaped
Usage: %%caption-escaped%%
The image caption from Instagram including tags, escaped for use in HTML attributes like title and alt.
caption-tags-no-hash
Usage: %%caption-tags-no-hash%%
The image caption from Instagram including tags without the #.
caption-tags-no-hash-escaped
Usage: %%caption-tags-no-hash-escaped%%
The image caption from Instagram including tags without the #, escaped for use in HTML attributes like title and alt.
caption-no-tags
Usage: %%caption-no-tags%%
The image caption from Instagram excluding tags.
caption-no-tags-escaped
Usage: %%caption-no-tags-escaped%%
The image caption from Instagram excluding tags, escaped for use in HTML attributes like title and alt.
caption-no-usernames
Usage: %%caption-no-usernames%%
The image caption from Instagram excluding username mentions.
caption-no-usernames-escaped
Usage: %%caption-no-usernames-escaped%%
The image caption from Instagram excluding username mentions, escaped for use in HTML attributes like title and alt.
caption-no-usernames-no-tags
Usage: %%caption-no-usernames-no-tags%%
The image caption from Instagram excluding tags and username mentions.
caption-no-usernames-no-tags-escaped
Usage: %%caption-no-usernames-no-tags-escaped%%
The image caption from Instagram excluding tags and username mentions, escaped for use in HTML attributes like title and alt.
tags
Usage: %%tags%%
The image tags from Instagram
tags-first
Usage: %%tags-first%%
The first image tag from Instagram
username
Usage: %%username%%
The username of who posted the image on Instagram.
instagram-user-profile-url
Usage: %%instagram-user-profile-url%%
The link to the Instagram profile of who posted the image.
Note: Cannot be used in the Title
instagram-user-profile-image-url
Usage: %%instagram-user-profile-image-url%%
The link to the Instagram profile image of who posted the image.
Note: Cannot be used in the Title
instagram-media-type
Usage: %%instagram-media-type%%
The type of Instagram media, i.e. image or video.
instagram-media-id
Usage: %%instagram-media-id%%
The ID of the Instagram media
instagram-url
Usage: %%instagram-url%%
The link to the Instagram media page.
Note: Cannot be used in the Title
instagram-image-url
Usage: %%instagram-image-url%%
The link to the Instagram image.
Note: Cannot be used in the Title
instagram-video-url
Usage: %%instagram-video-url%%
The link to the Instagram video.
Note: Cannot be used in the Title
instagram-embed-url
Usage: %%instagram-embed-url%%
The Instagram embed link for images and videos.
Note: Cannot be used in the Title
wordpress-image-url
Usage: %%wordpress-image-url%%
The link to the image if saved in the WP media library.
Note: Cannot be used in the Title
wordpress-video-url
Usage: %%wordpress-video-url%%
The link to the video if saved in the WP media library.
Note: Cannot be used in the Title
wordpress-post-url
Usage: %%wordpress-post-url%%
The link to the post created in WP.
Note: Cannot be used in the Title
gallery
Usage: %%gallery%%
A gallery of all images that have been saved to the WP media library for the post.
Note: Cannot be used in the Title or Meta
map
Usage: %%map%%
A Google map of the location of a geo tagged image.
Note: Cannot be used in the Title or Meta
location-name
Usage: %%location-name%%
The name of the location of a geo tagged image.
location-lat
Usage: %%location-lat%%
The latitude of the location of a geo tagged image.
location-lng
Usage: %%location-lng%%
The longitude of the location of a geo tagged image.
image-date
Usage: %%image-date%%
The date the image was taken on Instagram.
filter
Usage: %%filter%%
The Instagram filter used on the image.
likes
Usage: %%likes%%
The Instagram Likes count for the image.
Filters
You can amend and adjust the values returned by any of the template tags using filters.
The name of the filter hook is the in the same format for each tag; igp_template_[tag]
.
For example to change the %%caption-no-tags%%
you would use the filter igp_template_caption_no_tags
. Hypens in tags would need to be converted to underscores in the code.
So to create your own code to make use of the filter you would use something like the below in a separate plugin (adding to your theme’s functions.php
is a bad idea).
add_filter( 'igp_template_caption_no_tags', 'my_igp_template_caption_no_tags' );
function my_igp_template_caption_no_tags( $caption ) {
return $caption .' from Instagram without tags, caption changed by a filter!';
}
Now any images caption will have ‘ from Instagram without tags, caption changed by a filter!’ appended to it when the plugin runs and creates a post for the image.
Where shall I add the code? Take a look at http://dev7studios.com/adding-code-customisations-wordpress-the-right-way/