Template Variables
If you wish to specify a custom template you may need to know more about the variables that are available.
The template system used is called Twig and is fairly simple to use. The variables available to the template are:
items
contains and array of objects. Each object is a single product.item.link
the full URL to the Zazzle product.item.title
the title of the Zazzle product.item.content
the full URL to the large product image.item.thumbnail
the full URL to the small product image.item.price
the price of the product including currency symbol.
per_row
the number of items that have been requested per row.pagination
the output of the ZedPressPagination class. The pagination, ready to go.new_window
is a boolean that represents if the option to open links in a new window has been selected.
Important to note is that each property of items
will only be available when looping through the array. The raw
filter is required to be used on the output of the title as Zazzle provides it with the HTML and any entities already escaped. The same applies to the output of Pagination. escape('html_attr')
is used to make sure the title can be output to the image alt attribute without breaking it.
For more information on Twig please check out their documentation. The version of Twig used is version 1.x
to help with PHP compatibility as version 2.x
is restricted to PHP version 7.0 which not all servers are running yet.