Skip to content

Expression Language

WP-Nexus includes a rich expression language powered by Symfony ExpressionLanguage. Expressions are used throughout the platform -- in widget text bindings, pipeline node configs, style visibility rules, and template nodes.

Template Syntax

Expressions are embedded in strings using two delimiter styles:

{ { expression }} -- Escaped text output

The expression result is converted to a string. This is safe for display in HTML text content.

Hello, `{ {row.name}}`! You have `{ {count(row.items)}}` items.

<{ expression }> -- Raw HTML output

The expression result is passed through wp_kses_post(), which strips dangerous tags but allows safe HTML (paragraphs, links, bold, images, etc.).

<{content(row.post_content)}>

Use <{ }> when you need to render HTML from a database field or WordPress content.

Standalone Expressions

In pipeline node configs and visibility rules, expressions are evaluated without delimiters:

row.status == 'active'
row.price > 100
user_can('edit_posts')

Context Variables

Different contexts provide different variables:

Widget text bindings

VariableDescription
rowThe current data context (repeater row, data source result).

Pipeline node expressions

VariableDescription
rowThe current row being processed (in per-row operations).
inputThe full input data from the upstream node.

Pipeline config expressions

VariableDescription
inputThe data flowing into the node from its upstream connection.

Operators

Arithmetic

OperatorDescriptionExample
+Additionrow.price + row.tax
-Subtractionrow.total - row.discount
*Multiplicationrow.price * row.quantity
/Divisionrow.total / row.count
%Modulorow.id % 2
**Exponentiation2 ** 10

Comparison

OperatorDescriptionExample
==Equalrow.status == 'active'
!=Not equalrow.status != 'draft'
===Strict equalrow.count === 0
!==Strict not equalrow.value !== null
>Greater thanrow.price > 100
<Less thanrow.age < 18
>=Greater or equalrow.score >= 80
<=Less or equalrow.quantity <= 0

Logical

OperatorDescriptionExample
&& / andLogical ANDrow.active && row.visible
|| / orLogical ORrow.admin or row.editor
! / notLogical NOT!row.deleted

String

OperatorDescriptionExample
~Concatenationrow.first ~ ' ' ~ row.last

Ternary and Null Handling

OperatorDescriptionExample
? :Ternaryrow.vip ? 'Gold' : 'Standard'
?:Elvis (falsy fallback)row.nickname ?: row.name
??Null-coalescingrow.phone ?? 'N/A'
?.Null-safe accessrow?.address?.city

Membership and Pattern

OperatorDescriptionExample
inArray membershiprow.role in ['admin', 'editor']
matchesRegex matchrow.email matches '/@gmail\\.com$/'

Field Access

Dot notation

row.name
row.address.city
row.items.0.title

Bracket notation

row["field name"]
row["nested"]["field"]

Null-safe access

row?.address?.city

Returns null instead of erroring if any intermediate value is null.

Functions

WP-Nexus provides 36 built-in functions organized into categories:

Examples

Display a formatted price

$`{ {number_format(row.price, 2)}}`

Show a default value

`{ {default(row.bio, 'No bio provided')}}`

Conditional badge text

`{ {row.stock > 0 ? 'In Stock' : 'Sold Out'}}`

Format a date

`{ {date_format(row.created_at, 'F j, Y')}}`

Truncate long text

`{ {truncate(row.description, 100, '...')}}`

Check user permission

`{ {user_can('edit_posts') ? 'Editor' : 'Reader'}}`