Dynamic Data

Use dynamic data to render all sorts of data from your WordPress database with Bricks.

For example: Featured image, post title, post date, author name, categories, tags, site title, all of your custom fields, etc.

You’ll most likely use dynamic data when creating templates in Bricks. Such as your blog post template, and custom post type templates (e.g. single property listing).

How to insert dynamic data

The dynamic data picker for text shows up when typing a “{” onto the canvas. You can also click the “bolt” icon in the settings panel to reveal it:

Dynamic data for non-text settings such as images, videos, etc. is available from the “Select dynamic data” dropdown menu in the panel settings.

Below you can see an Advanced Custom Fields gallery (named “Gallery”) rendered inside the Bricks image gallery element:

Since Bricks 1.3.5, all the dynamic data tags are available in all the elements that support dynamic data. This means that you may insert a gallery field (like an ACF gallery field type) inside a text element and it will be rendered as a set of img tags (using the filter :image), like so:

Custom Fields Integrations

You can render much more than just standard dynamic WordPress data. Bricks supports the most popular custom fields plugins such as:

  • Advanced Custom Fields
  • Pods
  • Meta box
  • CMB2
  • Toolset (since Bricks 1.3.5)

This allows you to design templates for even the most complex custom post type layouts and data requirements.

Standard WordPress data

By default, you may use the following dynamic data tags.

Post fields

The following fields are related to the posts or custom post types.

{post_title} – Returns the post title
{post_id} – Returns the post ID
{post_url} – Returns the post URL
{post_date} – Returns post published date
{post_modified} – Returns post modified date
{post_time} – Returns post publish time
{post_comments_count} – Returns number of comments
{post_content} – Returns post content (Gutenberg editor)
{post_excerpt} – Returns the post excerpt
{read_more} – Renders an anchor tag (link) to the post with the label “Read more”
{featured_image} – Renders an image tag with the featured image

These fields support dynamic data filters, like the following:

{post_title:link} – Renders the post title as a link to the post
{post_title:link:3} – Same as before but the title is limited to 3 words
{post_excerpt:55} – Limit post excerpt to 55 words. Using the “:” followed by a number limits the output to that number of words
{featured_image:medium_large} – Renders an image tag with the featured image of size medium_large (defaults to thumbnail size)
{featured_image:large:link} – Renders an image tag with the featured image of size large wrapped by an anchor tag to the post

Taxonomies

The following dynamic data tags render lists of the taxonomy terms assigned to a post.

{post_terms_category}
{post_terms_post_tag}
{post_terms_my_taxonomy_slug}

Author Fields

{author_name} – Returns the post author name
{author_bio} – Returns the post author biographical info
{author_email} – Returns the post author email
{author_website} – Returns the post author website
{author_avatar} – Returns the post author avatar as an image tag (text) or an image url (link)

These fields support dynamic data filters, like the following:

{author_bio:20} – Post author biographical info limited to 20 words
{author_email:link} – Post author email rendered as a link
{author_website:link} – Post author website rendered as a link
{author_avatar:200} – Post author avatar image tag limited to the width/height of 200px

Current Date fields

You can render the current date through dynamic data.

{current_date} – Returns the current date with the format defined at WordPress > Settings > General > Date Format

You may specify a different date format using the PHP date format, for example:

{current_date:Y}
{current_date:Ymd}
{current_date:Y-m-d}
{current_date:Y.m.d}
{current_date:Y/m/d}
{current_date:Y m d}
{current_date:g:i A}

Site & Archive fields

{site_title} – Returns site title as defined in the WordPress settings > General > Site Title
{site_tagline} – Returns site tagline as defined in the WordPress settings > General > Tagline
{archive_title} – Returns archive title
{archive_title:context} – Add context to the archive title
{archive_description} – Returns archive description (author, post type or term)

Since Bricks 1.3.5, it is possible to get dynamic data from the URL parameters like so:

{url_parameter:my_key} – Returns the value of the my_key parameter in the url (https://mydomain.pt/?my_key=value)

User profile fields

{wp_user_id} – Returns logged in user ID
{wp_user_login} – Returns logged in user username
{wp_user_email} – Returns logged in user email address
{wp_user_url} – Returns logged in user website
{wp_user_nicename} – Returns logged in user nicename
{wp_user_description} – Returns logged in user biographical info
{wp_user_first_name} – Returns logged in user first name
{wp_user_last_name} – Returns logged in user last name
{wp_user_display_name} – Returns logged in user display name
{wp_user_picture} – Returns logged in user avatar image tag or url
{wp_user_meta:my_user_meta_key} – Returns logged in user “my_user_meta_key” meta value

Bricks hooks related with Dynamic Data

bricks/dynamic_data/exclude_tags – exclude a list of tags from the Bricks dynamic data logic

bricks/dynamic_data/replace_nonexistent_tags – Disable the default Bricks behavior of replacing the non-existent dynamic data tags with an empty string

×