5. What are templates?

Templates allow you to optionally broaden your output. They offer you total flexibility. You can easily adjust templates in the backend of WordPress.

The structure is designed really simple. Think of it just like the mail merge function of Word. You define the template and enter the proxies. During output on your WordPress page your proxy will be replaced by the correct value.

Templates can be easily managed via “Affiliate-Toolkit” -> “Templates”. Here you can create and edit all templates.

Import and export templates

In order to ease your work with the templates, we implemented an import and export function for the templates.

This way you can easily copy already created templates from installation to installation.

Suggestion: Our documentation contains some templates for downloading.

Export templates

In case you would like to export an already existing template, you simple need to open the overview of templates. The column “Action” allows you to export the template.

The template will be automatically downloaded afterwards.

Import templates

Templates can be imported via “Affiliate-Toolkit” -> “Tools” -> “Import templates”.

 

Create new template within the plugin

Basically, it’s really easy to create a new template via the surface. You simply need to know which kind of template you want to use.

We differentiate between the following types:

  • Product template
    Here you can access all fields of the main product incl. your user defined and ACF fields.
  • Offer template
    Here you access the proxies of your offers. The detail area is executed for every offer line of the product.
  • Picture gallery template
    Here you access the proxy of a picture. The detail area for every picture of the product is executed.
  • Comparison chart
    This type of template is special and has its own surface. But in general, it used just like a product template.

Detailed field information

The fields for the first three template types can be found here:

 

1. Type

As previously mentioned this is where you choose the type of template. Depending on the chosen type other proxies will become available.

2. Extended View

Here you can show resp. hide the heading line (4), header details (5), footer details (7), and the footer (8). Most of the templates don’t need these extended fields at all.

3. Header

The header is always the first part that needs to be completed. Here you can define e.g. the header of a table (<table>).

In the header area, you can access the proxies of the first product. Additionally, you can access the proxies %refresh_date% and %refresh_time%.

The proxy %listurl% is only available for lists.

4. Heading line (extended)

This header is executed for every line (product).

5. Header details (extended)

This header is executed once per line. The proxy {SYS_APPEND} works here.

6. Detail

The detail area is executed for every product. Here you can access all proxies of a product.

7. Footer details (extended)

The footer is executed for every line (product).

8. Footer (extended)

This footer is executed once per line. The proxy {SYS_APPEND} works here.

9. Footer

The footer area is executed only once, just like the header. But this one is placed at the end. In case of a table this one would be (</table). Here you can also use the same proxy you are using for the header.

10. CSS-Style

All CSS-styles relevant for templates are stored here and can also be defined external (e.g. in a style.css).

It is recommended, that only the styles for the corresponding template are stored here, so that no double output occurs. In case you are using the same template multiple times, you should save your CSS-style in the theme folder and not in this field.

11. Disclaimer of liability

In case you add a checkmark here (and if this checkmark is also activated in the settings) then the disclaimer of liability will not be added to the bottom of the template. If you don’t show prices or delivery information, then you also don’t need to activate the disclaimer of liability for your template.

12. Also show primary offer

Here you decide, whether the prices of the main product shall be included in the list or not (e.g. checked in the template “all offers”, but not activated in the template “additional offers”).

13. Max. number of offers

Here you can define a max. of offers for the output. E.g. in case you always just want to show the 5 cheapest offers.

14. Template proxies

This will show you the template proxies available for the current template type.

Template proxies

Here we will show you all proxies available upon delivery. This proxy is also available within the template editor itself (no. 14).

Product template and comparison table

Offer templates

Picture gallery templates

Template procedures

In order to clarify the whole process, we created a little example.

Easy process

With this process 90% of all templates can be designed and displayed accordingly.

atkp-ablauf1

Everything that’s added to the header section will be executed once. The detail area will be executed for every product. The footer will be, just like the header, only executed once.

Advanced process

In order to get to the remaining 10%, we added some additional fields (to be activated via the checkmark “advanced display”).

atkp-ablauf2

This way even complex comparison charts can be created. The header details, footer details, as well as the detail area can be “split” into lines. Via the proxy {SYS_APPEND} the template will be divided and then (based on the sequence) every template line will be connected with one another.

Create new template via file

In case you are using the Affiliate-Toolkit-Starter, premium functions such as templates will not be available. But you can still adjust templates and create your own templates. This of course all works without the premium version as well! Changes of the standard templates are only temporarily unsupported! ?

Details concerning the structure and the proxies can be found above.

The plugin index contains a subfolder called “templates”. Here you’ll find and adjust all standard templates. When you copy the template, you can as well create your own template. Please keep in mind: The template name needs to contain at least one letter otherwise your template won’t be searched for in the “template” directory.

To make the template changes update-proof, you should create a folder called “atkp-templates” in your “Theme”-index (child-theme). You can copy your templates into this folder. Also changes to the standard templates can be copied into this folder. This folder overrides the standard directory.

The structure of the file is generally the same as the one on the surface but you should have some PHP knowledge. The templates are all derived from the “/includes/atkp_default_template_base.php.php“ class.

Tipps for creating templates

Handling blank fields

Once a field is blank, it won’t be displayed. Here a shifting in layout may happen. The standard templates are created in such way that this doesn’t happen. But with user defined templates this may cause problems.

As a trick for “blank” fields &nbsp; (space) can be used. If this has been defined behind the proxy, the line along with its size will be kept.

 

More about templates

Do you still have questions? No problem :-)
We are happy to answer your questions in our forum.