TEMPLATE - MACRO REFERENCE
Tabella dei Contenuti
Per avere template dinamici, WP MoneyClick permette l’utilizzo di macro, all’interno del codice HTML e CSS che compongono i template stessi.
La sintassi generale di una macro è:
{{ macro }}
Ci sono 2 categorie di macro, che possono essere usate in contesti diversi:
- Macro Standard: sono sempre disponibili, con qualunque provider.
- Macro specifiche per provider sono utilizzabili solo con alcuni provider (tipicamente con i provider di affiliazione)
MACRO STANDARD
{{ _index }}
The current product index. Outside the template body this macro will return 0. Inside the product body block the value will enumerates the products (1, 2, 3, …).
Example: 1
{{ _date }}
The current system date in the dd/mm/yyyy format.
Example: 28/03/2016
{{ _dateFromToday(n) }}
Return a date that is ‘n’ days after today. Date is returned in the dd/mm/yyyy format. If ‘n’ is 0, the system return the today’s date. Available since version 3.8.0
Example: {{ _dateFromToday(1) }} will return the date of tomorrow (like 09/12/2020)
{{ _dateDMY }}
The current system date in the ‘dd/mm/yyyy’ format (same as {{ _date }} ).
Example: 28/03/2016
{{ _dateMDY }}
The current system date in the ‘mm/dd/yyyy’ format.
Example: 03/28/2016
{{ _dateYMD }}
The current system date in the ‘yyyy/mm/dd’ format.
Example: 2016/03/28
{{ _dateSHORT }}
The current system date in the ‘dd mmm yyyy’ format.
Example: 28 Mar 2016
{{ _dateLONG }}
The current system date in the ‘dd month yyyy’ format.
Example: 28 March 2016
{{ _dateISO }}
The current system date in the ISO format.
Example: 2016-03-28T21:31:26+00:00
{{ _dateDAY }}
The day of current system date.
Example: For the 28 march 2016, the result will be ’28’
{{ _dateMONTH }}
The month of current system date.
Example: For the 28 march 2016, the result will be ’03’
{{ _dateYEAR }}
The year of current system date.
Example: For the 28 march 2016, the result will be ‘2016’
{{ _time }}
The current time in the ‘hh:mm’ format.
Example: 21:09
{{ _timeLONG }}
The current time in the ‘hh:mm:ss’ format.
Example: 21:09:07
{{ _rating }}
Visualizza da 0 a 5 stelle in base al valore del data attribue data-wpmc-rating.
Esempio: {{_rating}}
{{ _random(min, max) }}
An integer random number between min / max (included).
Example: _random(2, 5) will return a random number between 2 and 5
{{ _request(paramName) }}
Ritorna il valore di un parametro della richiesta HTTP (GET / POST), o stringa vuota se il parametro non e’ definito.
Example: _request(myparam)
{{ _basepath }}
Restituisce la URL base al plugin WP MoneyClick.
Example: _basePath ritorna una string tipo ‘http://www.mysite.com/wp-contents/plugins/wpmoneyclick’
{{ _postTitle }}
Restituisce il titolo del post corrente. Utile per esempio per fare ricerche di prodotti in base al titolo del post corrente. Disponibile dalla versione 3.7.0.
Esempio: [ wpmc-amazon search=”{{ _postTitle }}” template=”product-box” ]
{{ attr:attrName }}
Read the value of template / content / shortcode data attribute. Note that this macro can be used, also, to read all the attribute values defined in the shortcode.
Example: [ wpmoneyclick id=’123′ count=’5′ data-wpmc-rating=’3′ data-color=’red’ ]
{{ attr:id }} will return ’12’
{{ attr:count }} will return ‘5’
{{ attr:data-wpmc-rating }} will return ‘3’
{{ attr:data-color }} will return ‘red’
MACRO SPECIFICHE PER PROVIDER
Queste macro sono utilizzabili con i provider di affiliazione (Amazon, eBay, Apple iTunes, Kelkoo, TrovaPrezzi, Pagomeno, Yeppon)
{{ provider }}
The content provider Example: ‘amazon’
{{ providerImage }}
The content provider logo URL.
{{ cid }}
The content ID. Example: 1235
{{ pid }}
The product / offer ID. The string value depends on the content provider. For example for an Amazon product this value will be like ‘B00NGOCP64′
Example: B00NGOCP64
{{ link }}
The complete URL that trigger the affiliation.
Example: ‘http://www.mysite.com/?_wpmcx=eyJ0IjoxLCJzIjoxLCJpZCI6IjE1MTY1MSIsImlkeCI6MX0%3D’
{{ title }}
The product title. The value coming from the provider can be overriden at content level (product title attributes).
Example: ‘Apple iPhone 6s’
{{ descr }}
The long description provided by the provider. If the provider is not passing this value, the product title will be used.
Example: ‘Apple iPhone 6s is a very powerful phone …’
{{ vendor }}
The vendor name. The merchant who is selling this product.
Example: ‘MediaWorld’
{{ vendorImage }}
The vendor small logo image URL. Note that this value is not provided by all content providers.
Example: ‘http://www.mediaworld.com/assets/logo.png’
{{ imageSmall }} {{ imageMedium }} {{ imageLarge }}
The product image URL (in different sizes). Note that not all the providers supply 3 different images, and image sizes are different (use CSS styling to get omogenous image sizes).
Example: ‘http://www.mediaworld.com/assets/phones/iphones6_150x150.jpg’
{{ currency }}
The currency symbol. The value is defined in the general settings, and can be overriden at single content level.
Example: €
{{ price }}
The product / offer price. Number of decimals depends on the general settings (and can be overriden at single content level).
Example: 89.90
{{ price_formatted }}
The formatted product / offer price, including currency symbol. Number of decimals depends on the general settings (and can be overriden at single content level).
Example: 89.90 €
{{ fullPrice }}
The product / offer full price (without discount). Note that this value is the same of {{ price }} when there is no discount.
Example: 190.90
{{ fullPrice_formatted }}
The formatted product / offer full price (no discount), including currency symbol. Number of decimals depends on the general settings (and can be overriden at single content level).
Example: 190.90 €
{{ discount }}
The % of discount (0 if no discount is available for this product).
Example: 15
{{ discount_formatted }}
The formatted % of discount (0 if no discount is available for this product), including a ‘-‘ prefix and a ‘%’ suffix.
Example: -15%
{{ discountValue }}
The amount of discount (0 if no discount is available for this product).
Example: 145.81
{{ discountValue_formatted }}
The formatted amount of discount (0 if no discount is available for this product), including a ‘-‘ prefix and a currency suffix.
Example: -145.81 €