Elementor is a powerful WordPress plugin for building web pages without code, and with its Theme Builder you can even build entire websites without code. The Theme Builder is powerful because it allows you to create templates that will be filled dynamically with content, such as a blog post page template to be used for each blog post page.
This means when you create a theme template you can’t set the content explicitly, because you want to show the content of each blog post with one single template. Elementor provides several widgets to access the post’s content, including the Post Title, Post Meta, and Post Content widgets.
These are great, but what if you want to use a different widget, such as a widget from a third-party pack you like? This is where Dynamic Tags come in. Dynamic Tags allow you to display dynamic content using any widget. Any field that has the Dynamic Tags icon next to it can be filled in with such a Dynamic Tag.
Elementor provides many Dynamic Tags out of the box, including Post Title, Post Custom Field, and Site Title. The built in tags can get you a long way, but sometimes you need more control over what content to display. Thankfully, the Dynamic Tags api allows developers to write their own Dynamic Tags. With this api, a developer can add a Dynamic Tag that outputs exactly the content they want.
We found that often we just wanted to call a simple function, usually a function built into WordPress, but we still had to add all the boilerplate code for the Dynamic Tag just to call the function. To ease this, we created a Dynamic Tag called Custom Callback.
The tag has a single setting, a text field which allows you to type in the name of the function you want to call. It can be a WordPress function, or a custom function you add to functions.php. This way you only need the one Dynamic Tag, and then you can just use existing functions or write functions yourself.
The Custom Callback tag is available in the Solid Dynamics plugin, so you can try it out yourself. We have found it to be a good tool to streamline work between our design and tech teams, and we hope you enjoy it too.