What is a Token?
A token is a piece of text enclosed in two specially formatted square brackets that serves as a placeholder for a dynamically generated value.
Show dynamic content by writing a single static shortcode.
[ user : first_name ]“.
Hello , you are using Elementor 3.1.4
Generic Placeholder Substitution
The first part
The second part
:is the Token itself. That is the value that will be replaced in place of the placeholder. For example
:first_nameindicates that we want the current First Name of the User Token object. If the data is an Array or an Object you can access to its subvalue using multiple time the subfield
The addon provide access to all basilar object of WP like:
- Specific variable
Usually here you have to write the name of the Field (or Subfield) of the Token object.
- Object native fields
- Meta fields
A filter is a data modifier.
A filter is substantially a function.
You can use all kind of filter like:
- all WP function
- PHP native function
- Custom function provided by plugins, themes of your theme function.php file
Fallback is that value that is inserted when the token returns an empty value.
You can provide a different object as Source of data.
Passing its ID or Unique name the fields will be fetched from this element.
As filter you can use all WP, PHP and Custom function.
- if the Token returns the string “Hello”, with the filter strtoupper the final result will be “HELLO”;
- if the Token returns the Post ID, with the filter get_the_post_thumbnail will be printed his Feature Image.
Add your function In your function.php file, where the function name will be the filter name.
It has a unique parameter which contain the Token result, it may be a String, an Array, an Object or null.
// do whatever you want
The Filters may accept also parameters, the Token’s value is automatically passed to the function as first parameter (or last for some function, like explode).
- substr(0,3) – gets the first 3 character of returned string;
- get_the_post_thumbnail(‘full’) – gets the full image, not the thumb.
You can add multiple filters, which will be execute in concatenation based on their order.
Write them separated by the “|” pipe:
[ post:title |sanitize_title|strtoupper|trim ]
Some Complete Examples:
post:title– print current Post Title, native field of this object (you can also write it without the repetitive post_)
post:_yoast_wpseo_metadesc– print current Post Meta Description, a post meta field created by 3rd part plugin (like ACF, PODS, …)
post:_thumbnail_id|wp_get_attachment_url– print the current Post Feature Image url
post:_thumbnail_id|wp_get_attachment_image_src(thumbnail)|reset– print the Featured Image thumbnail URL of current Post
post:ID|get_the_post_thumbnail(full)– print current Post Featured Image trough a core WP function with parameters or a placeholder image if post hasn’t got the Featured Image
post:date|strtotime|date_i18n("j F Y")– print the current Post Date in custom format
[post:date|strtotime|sum(86400)|date_i18n("Y-m-d H:i:s")– print the Post Date plus one day in default time format
post:type:labels:singular_name– print the Type Singular Label of current Post
post:permalink– print the unique url of Current Post, use
post:guidmay be an alternative
user:first_name– print logged User first name, or nothing if the page is viewed from a non authenticated visitor;
user:last_name|concat('Mr ',true)– print logged User last name with a prefix;
user:email|explode(@)|reset– print only username of current User Email (for example firstname.lastname@example.org);
user:nicename|trim?Anonimous!23– print trimmed User Nicename from user with ID 23, otherwise if user has no nicename or user not exist will print “Anonymous”;
user:roles– print logged in User Role, separated by a comma if multiple Roles.
Author (User alias)
author:display_name– print the name of Author of Current Post.
author:ID:count_user_posts– print the number of Posts written by current Author, it accept as parameter the CPT name
term:name– print Term name of Current Term or First Term of Current Post;
term:description|wpautop– print Term description with automatic paragraph;
term:description!123– print Term description of the Term with ID 123;
term:count!123– print Post count related to Term with ID 123;
term:link|last– print the url to Term Archive of the last term of current post;
term:txtarea|artist– print the value of an ACF field (like a Textarea) stored in Term of custom “artist” Taxonomy related to current Post;
term:term_id|category|posts|reset|get_the_title– print the Title of last published Post in same Taxonomy (Category);
term:term_id|posts|options!123– return all Posts related to Term 123 as Options for Elementor PRO Form;
term:thumbnail_id|wp_get_attachment_url(full)– return the url of the Media in Term Meta field which contain his ID.
option:elementor_version– print current version of the installed Elementor’s plugin from WP system options;
option:www_user_roles:editor:name|strtoupper– print uppercased name of Editor Role;
option:home|wp_logout_url– return to the direct Logout url and return to the Homepage.
date:+1 month– print the date of a month from today in WordPress default format;
date|Y m d– print the date of today in custom format;
date:user:registered– print the current User registration date in default WordPress format;
date:post:date:+2 days|Y-m-d H:i:s– print the current Post publish date + 2 days (optional) in standard datetime format.
system:get:my_query_var– print the variable stored inside $_GET, also compatible with POST, SESSION, COOKIE and SERVER systems vars;
system:cookie:my_favorite– print the value stored inside a Cookie, also used for Add to Favorite Widget;
system:server:REMOTE_ADDR– print the IP of the current visitor;
system:MY_CONSTANT– print the value of a constant previously declared in code.
query:user– print the list of all Users (Display Names);
query:user:email– print the list of all Users email;
query:user:editor– print the list of Editor Users (or any other Role);
query:user:customer|options("Guest")– create a Customer list in the Options setting of a Select Form Field with also an empty value “Guest”;
query:user:administrator:email– generate the list of all administrator emails, could be useful to fill the To recipient of a Form Email Action;
query:term– print the list of Terms (by default the Categories);
query:term:post_tag– print the list of Tags Terms (or any other Taxonomy);
query:post– print the list of the Posts (Titles);
query:post|count– print the number of published Posts;
query:post:uncategorized– print the list of the Posts without Category (or related to any other Term);
query:page– print the list of the Page (or any other Custom Post Type);
query:product|options– create the option list of all Products of your shop in a Select Form Field;
query:post:_thumbnail_id– print the list of the Featured Image Media ID of the Posts (or any other Meta Field);
query:attachment:guid|rand– print a random Media url.
wp_query:posts– print the id (or ids) of posts in the displayed page (like in archive);
wp_query:query_vars:paged– print the current pagination page number (return 0 on first page).
expr:5+(8*2)/3– execute a mathematic expression;
expr: [ post:my_num_val ] *2– execute a mathematic expression with dynamic values (nested Tokens);
expr: [ post:my_num_val ] + [ post:my_num_val ] * [ acf:coeff|123 ]– execute a mathematic expression with multiple dynamic values.
ROW:var_1|trim– print the variable ROW inside widgets with your own html structure.
Examples on 3rd part plugins:
acf:my_acf_field– print the value of ACF Field, where “my_acf_field” is the name of the field in ACF settings, it works also for subfield in rows of ACF Repeater;
acf:my_acf_field!123– print the value of ACF Field of the Post with ID 123;
acf:my_file:filesize|size_format(2)– print the Human readable size (with 2 optional decimal) of a ACF File Field;
acf:my_acf_field:title– print the label of ACF Field set in his configuration;
acf:my_select_field:settings:choices:red– print the label of a ACF Field Option set in his configuration;
acf:my_acf_field:settings:choices|options– use the choices of ACF Field Select set in his configuration as options in a Select Field of Elementor PRO Form.
product:_price– print current Product base Price;
product:_sku– print current Product SKU;
product:_price|Woo-tshirt-logo– print Product base Price of Product with a specific SKU.