Templates

If you want to display anything more complex than a simple text link then you can take advantage of the built in templates or create your own.

Use the Amazon Link > Templates Settings page to display all the available templates. On this page you can create, delete and copy templates. The template content is based on standard html with additional keywords that are surrounded by ‘%’ characters. These keywords are automatically filled in with the relevant Amazon product information.

See the Template Help section for a description of each of the keywords that can be used.

Keywords

Most of the keywords are self explanatory: '%TITLE%' will expand to be the product’s title, '%PRICE%' the formatted product’s price, etc.

However links can be created by using the keyword pair '%LINK_OPEN%' and '%LINK_CLOSE%' with the subject of the link being placed between them. For example '%LINK_OPEN%Amazon Product%LINK_CLOSE%'. The link produced will comply with whatever settings you have used, i.e. localised to the user’s country or produce a multinational popup, it will also use the appropriate Amazon associate IDs.

There are a number of other keywords that are also localised these include: '%LINK_OPEN%' – as described above, '%TLD%' the Top Level Domain to be used ‘.co.uk’, ‘.it’, ‘.com’, etc.; '%MPLACE%' – the Amazon Market place to use ‘GB’, ‘IT’, ‘US’, etc.; '%CC%' – the localised country code ‘uk’, ‘it’, ‘us’; '%TAG%' – The amazon associate tag to use.

There are a number of general purpose keywords that can be used to enter data directly in the shortcode; these are '%TEXT%', '%TEXT1%', '%TEXT2%', '%TEXT3%', '%TEXT4%'.

Template Settings

Template Type

You must ensure that the template type is set correctly when creating the template, it should be one of:

  • Product
  • Multi
  • No ASIN

For most templates this should be ‘Product’, which is used to create links about a single Amazon product using the ASIN entered in the shortcode.

If the template accepts a list of ASINS (e.g. like the Carousel widget) then the type should be set to ‘Multi’, and the template should include the keyword '%ASINS%' instead of '%ASIN%'.

If the template does not require an ASIN to be specified then set the type to ‘No ASIN’, typically used for Banners, Scripts and more general items.

Disable Preview

If you do not want the template to be shown on the Template Options page (e.g. It’s full of javascript or incomplete HTML tags) then select this option to stop it being rendered.

Country Modifiers

If you want an item in the template to be forced to output information from a specific locale you can apply country modifiers to the template keywords.

For example you wish to show the prices from a number of locales.

This is possible by adding a country modifier to the end of the Template keyword, one of (UK#, CA#, CN#, DE#, ES#, FR#, IN# IT#, JP#, US#). This can be applied to any of the template keywords.

So %PRICE%UK#, %PRICE%DE#, %PRICE%FR# would generate a list of prices from the UK, Germany and France.

Default Templates

The plugin contains a set of basic templates to show how the keywords can be used. The easiest way to create new ones is to copy one of the existing ones and update it to meet your needs.

Most of these templates were created by using the Amazon Affiliate site, generating the widget or link required then copying the generated output into the ‘Template Content’ box. Then quickly replacing any of the static data with template keywords, e.g. the product ASIN, Title, etc.

Currently the plugin has default templates for:

  • Add To Cart Button
  • Thumbnail link
  • Image link
  • Multinational Template
  • Amazon Iframe based Image link
  • Amazon Carousel Widget
  • Amazon My Favourites Widget
  • Amazon MP3 Clips Widget
  • Amazon Enhanced Pop-up Script
  • Amazon Easy Banner
  • Wishlist Template

Bear in mind that the Amazon templates are based on javascript hosted on the Amazon site, as such are often blocked by adblocker software. Also some of these ‘Widget Source’ based templates are not available in certain locales (Canada, China, Italy and Spain).

The ‘Wishlist’ template is the default template used for any lists created by shortcodes, as such it must exist.

Template Management

The plugin provides access to the ‘Default Templates’, these are the ones provided by the plugin. If you accidentally delete a template that you still want or have edited one and it stops working, you can use this page to re-install the default templates.

There are two options, either ‘Install’ which will add the template to your existing list (this creates a new copy of the default template, e.g. ‘Thumbnail2’ if it already exists). If the plugin detects that the default version has been upgraded then the ‘Upgrade’ option will be available this which will overwrite any existing template with the same Name with the new version.

If you are viewing your existing installed templates there is also an option to ‘Reset’ the template back to its default content.

The plugin includes some basic version tracking, based on the Name of the template and the version installed. If you rename the template then it will not be recognised as one of the defaults. The plugin does not track any changes you make to the template, so if you ‘Upgrade’ or ‘Reset’ a template your changes will be lost.

Exporting Templates

If you wish to backup your templates or move them to another WordPress installation then select the ‘Export’ button at the bottom of the Templates section. This will export the details of your templates to a plugin file located in ‘amazon-link/extras/amazon-link-exported-templates.php’. Copy and activate this plugin to add your templates to the list of Default Templates.