Templates decide how your products look on your website: as a wide box, a grid, a table or a single price button. affiliate-toolkit ships with ready-made system templates, and you can create your own templates directly in the WordPress backend.
A template works like a mail merge: you write the HTML once and insert placeholders, and affiliate-toolkit fills in title, price, image and link of each product when the page is displayed. You manage all templates under affiliate-toolkit → Templates.
System templates
System templates come with the plugin and its modules, for example box, wide, secondwide, bestseller, grid_2_columns, grid_3_columns, datasheet or detailoffers. You use them in a shortcode by name: [atkp_product id="123" template="wide"][/atkp_product]. The overview shows a preview image for each one.
System templates cannot be edited, but every one has a Duplicate action. The copy becomes your own template, which you can change freely. That is the fastest way to start.

Create your own template
- Go to affiliate-toolkit → Templates and click Add New (or duplicate a system template).
- Enter a name and choose the Type. For product boxes and lists that is "Product template". Modules add more types: "Compare table" (Responsive Compare Table), "Search form template" (Frontend Search) and "Old template" (Template Compatibility).
- Write the markup in the editor. The toolbar above it inserts containers (default box, two or three columns), loops (product, product + offers, product + images) and every placeholder: product fields, offer fields, image fields, custom fields and, if ACF is active, ACF fields.
- Add your CSS in the CSS field below the editor and save.
- Use the template with its ID:
[atkp_list id="456" template="789"][/atkp_list]. The overview shows the ready-made shortcode.

A minimal example
Every product template needs a loop over $products. This template shows title, price and button of each product:
@foreach ($products as $product)
<div class="my-product">
<strong>{{ $formatter->get_title($product) }}</strong>
{{ $formatter->get_pricetext($product, $translator->get_price()) }}
<a {!! $formatter->get_button_link($product) !!}>{!! $formatter->get_button_text($product) !!}</a>
</div>
@endforeach
Technical background
Product templates use the BladeOne engine, a standalone version of the Blade engine known from Laravel. Blade gives you loops (@foreach), conditions (@if) and safe output ({{ }} escapes, {!! !!} outputs HTML). These variables are available in every template:
| Variable | Content |
|---|---|
$products | Array of the products to render. |
$shops | Array of shops, if a template renders shops instead of products. |
$formatter | Helper with all formatting methods (title, price, links, images …). |
$translator | Translated standard texts such as "Price: %s". |
$parameters | All options from the shortcode, the template and the settings. |
$shop | The shop of the first product. |
The full list of methods is in Placeholders for Blade templates. For security, PHP tags, @php blocks and @inject are removed from templates created in the backend; PHP functions inside {{ }} expressions still work.
Provide your own variables
With the filter atkp_modify_bladedata you can pass your own values or objects to every template:
/**
* Add your own variable to every Blade template.
*
* @param array $bladedata Variables passed to the template engine.
* @return array
*/
function my_atkp_modify_bladedata( $bladedata ) {
$bladedata['site_name'] = get_bloginfo( 'name' );
// Available in the template as {{ $site_name }}
return $bladedata;
}
add_filter( 'atkp_modify_bladedata', 'my_atkp_modify_bladedata' );Import and export templates
To move a template to another website, export it and import it there.
- Export: in the template overview, hover over your template and click Export. A
.jsonfile is downloaded. - Import: click Import template at the top of the overview, choose the file under "Template file" and confirm. Files with the extension
.jsonand older.txtexports are accepted; ZIP files must be unpacked first.
Since version 3.8.6, raw PHP code (for example
<?php ?>tags) is removed from imported templates and is not executed. Only import templates from sources you trust.
Troubleshooting
Templates are quick to build once you know the structure. Until then, these tips help:
Show error messages
By default, errors are hidden on the website. While you build a template, go to affiliate-toolkit → Settings → Display settings and untick Hide error messages on the web page. A box with the error message then appears instead of an empty output. Tick it again when you are done. Errors are also written to the affiliate-toolkit log.
Variable used outside its loop
The most common error is a placeholder that uses a variable which does not exist yet:
{{ $formatter->get_title($product) }} <!-- error: $product does not exist yet -->
@foreach ($products as $product)
{{ $formatter->get_title($product) }} <!-- correct -->
@endforeachMove the line into the @foreach loop and the error is gone. The same applies to $offer and $image, which only exist inside their own loops.
Undefined method get_mediumimage
The toolbar entry "Medium image" inserts get_mediumimage($product), but the method is called get_mediumnimage($product). Correct the name in your template.