Work With Dynamic Content

In this article, we're going to talk about the Dynamic Content feature.

  1. What is Dynamic Content?
  2. How to Add Dynamic Content?
  3. Dynamic Content Syntax
  4. Where to Find the Dynamic Content Button?
  5. Summary

What is Dynamic Content?

The Dynamic Content is a way to input dynamic data into the page which fundamentally changes the way you can build out content throughout your site. The traditional way of adding content into the page builder was to hard code data inside the elements. This means that you have to write in any piece of content for your page manually. For example, let's say you were building out a button that links to a specific product you have set up in WooCommerce:

Dynamic Content 01

Now let's say that you wanted to add the sale price to the first line to help incentivize someone to click on offer:

Dynamic Content 02

You have always been able to handwrite these values in, but what about if you update the pricing down the road? What if you have three buttons on your page referencing this price? What if you have 15 buttons throughout your entire site referencing this price? Having to search down each button to update the price over and over again is not only tedious but also a huge waste of time. Dynamic content allows you to dynamically pull values from your site's database to use throughout your site.

How to Add Dynamic Content?

To add the dynamic content, any input that accepts content throughout the builders now features the Dynamic Content button:

Dynamic Content 03

Clicking that button will reveal the Dynamic Content popup where you can see all of the types of Dynamic Content available:

Dynamic Content 04

The available options available in Dynamic Content are as follows:

  • Post: Includes information related to your post types such as titles, excerpts, featured images, published date and time, ID, meta, et cetera.
  • Archive: Includes information related to your post type archives such as descriptions, URLs, meta, et cetera.
  • User: Includes information related to users such as display names, email addresses, Gravatars, meta, et cetera.
  • Global: Includes information related to your site such as the title, tagline, home URL, admin URL, current date and time, et cetera.
  • ACF: Allows to pull meta information from the ACF plugin. ACF plugin is required for this option to work.
  • Toolset: Allows to pull meta information from the Toolset plugin. Toolset plugin is required for this option to work.
  • WooCommerce: Allows to pull product and meta information from the WooCommerce plugin. Woocommerce plugin is required for this option to work.

By default, clicking the button for a piece of Dynamic Content will output the most relevant piece of information. However, there might be times where you want to pull a specific piece of content from a certain post, user, et cetera. To do this, clicking on the cog icon next to each item will reveal the edit pane for that piece of content:

Dynamic Content 05

Above, we can see that by default when using the Post Title Dynamic Content tag, it will pull the title of the current post you're on. However, clicking into the dropdown will reveal that you can pull other options such as the Previous Post:

Dynamic Content 06

It is also possible to pull the title from a Specific Post. In that case, an ID input will be revealed where you can specify the ID of the post you wish to pull the title from:

Dynamic Content 07

Click here for more information on how to find the ID of a post.

Dynamic Content Syntax

Each of the Dynamic Content customization panes will look slightly different based on the item you're working on as it will reveal relevant information for that content.

The preview area next to the + updates itself to show you the actual syntax that will be placed in your inputs. As you use the tool, you may find that you remember certain pieces of syntax you use over and over, and in that case, you can just type them directly into any input and bypass the picker completely.

The picker is merely a tool to help guide users through making these selections.

Once you click the + button, the syntax shown in the preview will be appended to the input you were adding the Dynamic Content to. Some of the primary benefits of using this special syntax include:

  • You can add multiple pieces of Dynamic Content within the same input.
  • You can go back later and edit the content directly from the input without having to open the editor.
  • If you use pieces of Dynamic Content over and over again and are familiar with their syntax, you can type them into an input directly without having to use the editor.

Where to Find the Dynamic Content Button?

There are a few different places where you'll find the Dynamic Content button hanging out throughout the builders. The bottom right corner of the long-form text editors:

Dynamic Content 08

And the upper right corner of the image controls:

Dynamic Content 09

Summary

We've talked about the Dynamic Content feature which gives you the ability to pull dynamic information from WordPress and selected third-party plugins and show them. Additionaly we've discussed different options of the feature, syntax and the location of the feature in the Page Builder.

See something inaccurate? Let us know