Skip to main content

Dynamic Data

Dynamic data lets you display live WordPress content — post titles, user names, dates, custom fields — directly in your templates. You write expressions like {{ post.title }}, and visitors see the actual content.

How expressions work

Expressions are wrapped in double curly braces {{ }}. Inside, you access data through providers, transform it with filters using the pipe | operator, and call functions directly.

{{ post.title }}                    {# Access data #}
{{ post.title|upper }} {# Transform with a filter #}
{{ post.date('F j, Y') }} {# Call a method with arguments #}
{{ post.subtitle ?? post.title }} {# Fallback if null #}
{{ get_post(42).title }} {# Call a function #}

Providers

Providers are the variables you use to access data. Which ones are available depends on the page context.

Root providers

These are directly available in your expressions:

ProviderAvailable onDescription
postSingle posts/pages, loopsCurrent post or loop item
userAll pagesCurrent logged-in visitor
authorPosts, author archivesPost author — same fields as user, different person
siteAll pagesGlobal site settings and URLs
termTerm archives, term loopsCurrent taxonomy term
archiveArchives, searchArchive title and type
requestAll pagesURL parameters and referrer

Chained providers

These are not root variables — you reach them by chaining from another provider:

ProviderAccessed viaDescription
Imagepost.thumbnail, site.iconImage URL, dimensions, alt text
AttachmentLoop over attachmentsFile info for non-image attachments
{{ post.thumbnail.src('large') }}   {# Image provider via post #}
{{ site.icon.src }} {# Image provider via site #}
{{ post.author.name }} {# User provider via post #}

Context detection

Unblock automatically provides the right data based on the page type:

Page typeAvailable providers
Single post/pagepost, author, user, site, request
Term archiveterm, archive, user, site, request
Author archiveauthor, archive, user, site, request
Search resultsarchive, user, site, request

Inside a Loop block, the loop variable (e.g. post, term) resolves to the current item, not the page-level context.

Quick examples

{# Post data #}
{{ post.title }}
{{ post.excerpt }}
{{ post.thumbnail.src('large') }}
{{ post.author.name }}
{{ post.date('F j, Y') }}
{{ post.meta('price') }}

{# User data #}
{{ user.logged_in ? 'Welcome!' : 'Please log in' }}

{# Fallbacks #}
{{ post.subtitle ?? post.title }}
{{ post.meta('image') ?? '/default.jpg' }}

Lazy evaluation

Expressions are evaluated on-demand. When you write {{ post.subtitle ?? post.title }}, the title is only fetched if the subtitle is null. Branches that are never reached don't trigger any queries.

Next steps