Exploring Dynamic Data Tag Filters in Bricks Builder

Bricks Builder provides a powerful set of dynamic data tags that helps to design complex dynamic web pages by rendering all sorts of data from the WordPress database. 

The wide range of Dynamic tags covers almost all sorts of data you can think of in WordPress. This includes standard WordPress data and custom field data from various third-party plugins like ACF, MetaBox, CMB2, Pods, JetEngine, and Toolset. 

While the data tags can render the raw data from the database, there is one more feature that adds more power to these data tags – Dynamic Data Tag Filters. They allow you to modify how data is rendered on the front end. 

Before diving deep into Data Tag Filters, let’s quickly look at some of the Dynamic Data tags that Bricks Builder provides. 

Jump quickly to Dynamic Data Tag Filters

Standard WordPress Data Tags

Post Fields

These tags render data related to Posts/Pages or any other 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

Taxonomies

Render the list of taxonomy terms assigned to a post. Each term will be wrapped in an anchor tag linking it to the archive of that respective term. 

{post_terms_category}
{post_terms_post_tag}
{post_terms_my_taxonomy_slug}

They are useful while designing a Single Post template or inside the query loop. 

Terms

The following data tags render the data related to taxonomy terms. 

{term_id} – Renders the term ID
{term_name} – Renders the term name
{term_url} – Renders the term archive link
{term_description} – Renders the term description
{term_meta:my_term_meta_key} – Renders the “my_term_meta_key” meta value

These tags are to be used while designing a term archive template where you might need to display term-specific data. 

Author Fields 

Render all the info of the current post author. 

It can be used on a Single post template or in a query loop to show author data of the current post’s author. 

{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)

User Profile Fields

These tags render the profile data of the logged-in user. 

{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

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

Native WordPress Custom Fields

All the tags mentioned above refer to standard WordPress data. But you might want to display data from a custom field (native custom fields, not from some plugins). 

For this, prepare the dynamic tag by adding the prefix cf_ to the field key. For example, if your field key is “city_name”, then the dynamic tag will be . 

Here, field key is the meta key that is used to save the data in the post-meta table. 

Echo Tag

Bricks Builder also allows you to create your own function to output any complex data. Just write your own logic in a function and use an echo tag to render the data. 

For example, {echo:my_dynamic_data} will call the PHP function my_dynamic_data and renders the value returned by this function. 

You can write this function in the functions.php file of your child theme. 

If you are new to using child themes, we have a detailed guide available to help you with this. 

How to create a child theme for Bricks Builder Theme

All these tags will render the data in raw format unless used with Data Tag Filters. 

Data Tag Filters

Data Tag Filters change the output of dynamic data. 

There are various types of data tags available. Let’s check them along with some examples. 

Numeric

When used field the tags that return text-based data, it trims the data by words. 

Example: {post_title:2}

This will display the field 2 words of the post title. 

The numeric filter can also be used on the author avatar tag. When used with the Author avatar tag, it specifies the avatar’s size (height/width). 

Example: {author_avatar:200}

This will render the avatar 200px. 

Image

It outputs the data as an image tag. It can be used with a custom field that returns the image URL or with ACF image or gallery fields. 

Example: {cf_cover:image}

You can also specify the size with the image tag. This should be a registered media size like thumbnail, medium, large, etc. 

Example: {cf_cover:image:medium}

This super useful data tag filter can be used in various contexts. 

In most cases, it wraps the data in an anchor tag pointing to the current post. 

Example: {post_title:link}

This will wrap the post title in a wrapper link pointing to the respective post URL. 

To open the link in the new tag, use its companion filter :newTab 

Example: {post_title:link:newTab}

Link filters can also be used with custom fields returning URLs or emails. 

Example: {cf_location_url:link}

This will echo the URL saved in the custom field location_url and wrap it in an anchor tag linking to the same URL. 

Example: {cf_contact_email:link}

If the field is returning the email, this will add an anchor tab with mailto link. 

Tel

Wrap the output in an anchor tag with a tel link. 

Example: {cf_contact_phone:tel}

Output: <a href=“tel:+1234567890”>+1234567890<a>

Dynamic Tags and Dynamic Tag Data Filters give you the ultimate power to consume the dynamic content in your layouts. You can use them in singular layouts or within the query loop to make a dynamic content structure.

Leave the first comment