Templates

Basics

You can find all provided PHP template files inside the plugin folder templates. These temples will be used by AAWP in order to display lists, tables and single product boxes.

In case you want to edit existing or create new templates, you will find all information in our templating documentation.

Note: Please don’t edit original files inside the plugin folder due to the fact that they will be overwritten with the next update!

Template functionality

Right now the Amazon Affiliate WordPress plugin provides the following template types: layouts, products and parts. Layouts holding the basic (HTML-) skeleton and including a product template in order to display single products.

Thereby it’s possible to use different layouts with the same product template without writing redundant code: e.g. showing products one below the other and side by side as grid. Template “parts” are little HTML fragments (e.g. button) which were outsourced in order to allow updating them easily.

Layout templates

Template Description
loop.php
(default)
Loop in order to display multiple products one below the other
grid.php Loop in order to display multiple products side by side (grid)
table.php Displays multiple products as a standard table
widget.php Loop in order to display multiple products in widgets

Layout templates are located in the root directory: /templates/.


Product templates

Template Description
horizontal.php
(default)
Product box, making use of the full width of the page
list.php Representing one row of a product list
vertical.php Product box, compact and vertical (squared)
widget-small.php Compact product presentation for widgets, including thumbnail, title, rating and price
widget-vertical.php
(default)
Product box for widgets, compact and vertical (squared)

Product templates are located in the corresponding sub-directory: /templates/products/.

Impact on templating

Loading a template simplified looks like:

Layout (loaded 1 time) >>> product (loaded for each single product)

Depending on your intention when using templating, it’s recommendable to replace a single product template only, otherwise you can move the product template content into a layout template as well.

Was this article helpful?

Related Articles