Modifiers reference
Modifiers change a tag's value: @post(title).uppercase(). Chain as many as you need; they run left to right. Arguments in brackets are optional unless noted.
Text
| Modifier | What it does |
|---|---|
uppercase(), lowercase() | Changes the case. |
capitalize() | Capitalizes the first letter. |
truncate(length, suffix) | Shortens to a number of characters (default 100), adding a suffix (default …). |
truncate_words(words, suffix) | Shortens to a number of words (default 20). |
prepend(text), append(text) | Adds text before or after, only when the value isn't empty. |
replace(search, replace) | Replaces text. |
strip_tags() | Removes HTML tags. |
slugify() | Turns text into a URL-friendly slug. |
pluralize(singular, plural, include_value) | Picks a word by the number: @post(reviews).pluralize("review", "reviews"). |
trim() | Removes spaces at the start and end. |
Numbers
| Modifier | What it does |
|---|---|
number_format(decimals) | Formats with the site's thousands and decimal separators. |
currency_format(currency, in_cents, always_fraction) | Formats as money. The currency is an ISO code such as EUR; the default is USD unless your site changes it. Set in_cents when the number is stored in cents. |
round(precision) | Rounds to a number of decimals (default 0). |
clamp(min, max) | Keeps the number within a range. |
abbreviate(precision) | 12400 becomes 12.4K. |
ordinal() | 2 becomes 2nd. |
Dates
| Modifier | What it does |
|---|---|
date_format(format) | Formats a date using WordPress date format characters, in the site's time zone and language. Default F j, Y. |
date_modify(change) | Shifts a date: "+1 day", "-2 weeks". |
time_diff(timezone) | How long until or since the date, such as 3 days. Write "ago" or "in" around it yourself. |
to_age() | Years since the date, for example a birth date. |
Lists
| Modifier | What it does |
|---|---|
first(), last() | The first or last item. |
nth(index) | One item, counting from 0. |
count() | How many items there are. |
list(separator, last_separator, prefix, suffix) | Joins the items: .list(", ", " and ") gives "Ana, Bruno and Carla". |
shuffle() | Random order. |
loop_index(base) | Inside a data loop, the item's position (starting at 1, or at the base you give). Offsets keep counting, so the first item shown after skipping two is 3. |
Fallbacks
fallback(value) shows another value when this one is empty: @post(subtitle).fallback(@post(title)).
Conditions
Conditions check the value and pass or fail. On their own they output nothing useful; combine them with then() and else():
text
@post(stock).is_less_than(5).then("Almost gone!").else("")| Condition | Passes when the value… |
|---|---|
is_empty(), is_not_empty() | is empty / has a value |
is_checked(), is_unchecked() | is on / off (Switcher) |
is_equal_to(value), is_not_equal_to(value) | equals / doesn't equal |
is_greater_than(value), is_greater_than_or_equal(value), is_less_than(value), is_less_than_or_equal(value) | compares as a number |
is_between(start, end) | is within a range |
is_one_of(values) | matches one of several values |
contains(value), does_not_contain(value), starts_with(value), ends_with(value) | contains or starts or ends with text |
matches(pattern) | matches a regular expression |
is_past(), is_future(), is_today() | is a date before, after, or on today |
is_first(), is_last() | is the first or last item shown in a loop |
The same conditions are used by the Dynamic tag rule in visibility.
Previews that take a moment
Most modifiers run instantly in the editor. A few need the server to calculate, so their preview can take a moment to appear: date formatting and date calculations, currency formatting, strip_tags(), slugify(), shuffle(), #math variables, and all conditions. The published page always shows the final result.
Technical details for LLMs
- Keys by group: text
uppercase,lowercase,capitalize,truncate,truncate_words,prepend,append,replace,strip_tags,slugify,pluralize; numbernumber_format,currency_format,round,clamp,abbreviate,ordinal; datedate_format,date_modify,time_diff,to_age,is_past,is_future,is_today; listfirst,last,nth,count,list,shuffle,loop_index; generalfallback,trim;let; conditionalsis_empty,is_not_empty,is_checked,is_unchecked,is_equal_to,is_not_equal_to,is_greater_than,is_greater_than_or_equal,is_less_than,is_less_than_or_equal,is_between,is_one_of,contains,does_not_contain,starts_with,ends_with,matches,is_first,is_last,then,else. - Server-only (not client-resolvable):
date_format,date_modify,time_diff,to_age,currency_format,strip_tags,slugify,shuffle,let, and every conditional. is_first/is_last/loop_indexread the loop level named by the tag they're attached to; outside a loop the conditions fail.- Currency default: filter
vxframework/dynamic-data/default_currency(defaultUSD); override rendering withvxframework/dynamic-data/currency_format. - Live list with argument schemas:
vx-framework/get-dynamic-data-catalog. Register modifiers withvxframework/dynamic-data/modifiers(see Developers → Extending).