Own box templates

Design product boxes, cards and list entries yourself – HTML with placeholders such as {{title}} and {{{button}}}, with code editor, live preview, import and export. No PHP; links, tracking and required notices stay correct.

Under "affilinode" → "Templates", administrators create templates of their own. A template is HTML with placeholders; there is no PHP in it. The built-in product box, the card, the list entry or an empty template serve as a starting point. Next to the editor are all placeholders – one click inserts them at the cursor. Errors appear with a line number, the preview below shows sample products while you type. Nothing is saved until "Save template".

Use a template

                  [affilinode_product id="123" template="custom:my-box"]
[affilinode_list id="bestenliste" template="custom:my-card"]
                
  • Works with affilinode_product, affilinode_products, affilinode_list, affilinode_amazon_list, affilinode_deals and affilinode_context – and in the blocks and Elementor widgets under "Layout" ("Own template: …").
  • The type of the template determines the arrangement in lists: "Card" in the grid or carousel, "Product box" and "List entry" one below the other.
  • If the template does not exist or contains errors, the built-in display appears; signed-in editors see a notice.
  • The mini card on text links has a fixed display – it is created in the browser and cannot be designed with a template.

Syntax

  • {{title}} – a value, automatically escaped (in href and src checked as an address).
  • {{{button}}} – a ready-made part of the plugin (HTML). Three braces only work for these parts; other values stay escaped.
  • {{#if rating}}…{{else}}…{{/if}} and {{#unless stale}}…{{/unless}} – conditions.
  • {{#offers}}…{{/offers}} or {{#each offers}}…{{/each}} – loop; inside it {{@number}}, {{@first}}, {{@last}}. {{^offers}}…{{/offers}} – only if the list is empty.
  • {{best.price}} – paths with a dot; {{! comment }} – does not appear in the output.
  • Placeholders belong between tags or in attribute values with quotation marks – not in on… attributes, <script>, <style> or comments.

Placeholders

  • Product: title, brand, badge, badge_type (winner, value or empty), description, rating (for example 4.5), rating_count, image_url, id, marker (note for replacement products); lists highlights, pros and cons with {{text}}.
  • Ready-made parts: {{{image}}}, {{{gallery}}}, {{{stars}}}, {{{badge_html}}}, {{{review_badge}}}, {{{highlights_html}}}, {{{proscons_html}}}, {{{description_long}}}, {{{notice}}}, {{{status_html}}}, {{{ebay}}}.
  • Price and best offer: purchasable, stale, price, old_price, savings, shipping, availability, delivery, shop, condition, price_checked, sales_rank, status, others_count, others_from; as HTML {{{price_html}}}, {{{availability_html}}}, {{{delivery_html}}}, {{{shop_html}}}, {{{ship_line_html}}}, {{{savings_html}}}.
  • Links: {{{button}}} and <a class="…" {{{link_attrs}}}>…</a> to the best offer; offers with shop, price, old_price, savings, shipping, availability, delivery, condition, price_checked, stale, is_best, {{{button}}}, {{{link_attrs}}}, {{{price_html}}}, {{{shop_html}}} and {{{availability_html}}} per offer.
  • In lists: in_list, position, rank (only with rankings) and note.
  • Required notices: {{{disclaimer}}} (ad label, affiliate notice, price date, Amazon notice), {{{sources}}} (sources of the data sheet values), ad_label and price_note as text.

What the plugin ensures

  • Links to the shop exist only through {{{button}}} and {{{link_attrs}}} – there is no placeholder with the raw affiliate address. So tracking ID, sub IDs, redirects of your own (/go/…), "Add to Amazon cart" and click tracking always apply.
  • Every link of a template gets rel="sponsored nofollow".
  • If {{{disclaimer}}} or {{{sources}}} are missing in a single box, the plugin appends them at the bottom. In lists they appear once below the list, as before.
  • The output goes through wp_kses for all users with a fixed list of allowed elements and attributes: <script>, <style>, <iframe>, style and on… attributes and javascript: links are dropped. This also applies to administrators.
  • Limits: 30,000 characters per template, 8 levels of nesting, 50 templates per website.

Styling, AMP, export

  • There is no CSS field of its own per template. Give your HTML classes and style them under "Appearance" → "Customizer" → "Additional CSS" (in the site editor under "Styles"). Start the selectors with .acp-tpl--<slug>, then it only affects this template. If a template had CSS so far, the plugin shows it once for copying; it is no longer output.
  • On AMP pages, templates appear only if they contain no <script>, <style>, <img> of their own, no form elements and no style or on… attributes – otherwise the built-in display. Use {{{image}}} for images.
  • Templates are part of the settings file ("Export and import settings") and can be exported and imported individually or all together as JSON under "Templates". Templates with the same slug are replaced.

All help articles · Still a question? Write to us