Dynamic Shortcode Values

When using a template, it is required that it's content will be dynamically populated with the data from the page, post, product or category it will be applied to.

For example, you might want to create a single product page template where you'll use a custom heading shortcode to display a product title. Dynamic Shortcode Values component allows to easily overwrite any shortcode's attribute, content or your custom text placeholder with your custom value.

See Demo Video

Automatically integrates with all your existing shortcodes

There is nothing you need to do special to get the power of Dynamic Shortcode Values as it automatically extends all your shortcodes registered in WordPress and Visual Composer.

In Visual Composer you'll see the additional tab "Dynamic Values" appeared in Edit Panel.

Unlimited replacements

Dynamic Values builder allows to create unlimited amount of dynamic replacements for each shortcode. You can replace the following data in every shortcode:

  1. Shortcode attribute
  2. Shortcode content
  3. Custom text placeholder

Tons of replacement values

The component comes with dozens of prebuilt functions, shortcodes and hooks to give you access to almost any data of your website. You can find the following groups and categories of dynamic replacements:

  • Generic
    • Queried object meta: allows to access meta data of the currently queried object (post, term, author, product). For example, its product price, wether it's featured or not, or any other custom meta value.
    • Queried object property: allows to access property of the currently queried post, term, product or author. For example, its title or description.
    • Filter hook: allows to retrieve a value by applying known filter
    • Action output: captures the rendered HTML by running specified WordPress action hook
    • HTTP Request: allows to supply data passed by GET or POST request
    • Theme template: renders template in your child or parent theme by specified path and captures its output. For example, you may use it to render comments, main content, sidebar or whatever useful functionality your current theme provides
  • Common
    • Attachment: supplies access to all needed data of the currently queried attachment page
    • Author: access data of the currently shown author page
    • Post: one of the most used type to access data of the currently displayed standard or custom post type (blog post, page, WooCommerce product, portfolio, etc.)
    • Sidebar: allows to replace value with any registered sidebar in your website
    • Term: access data of the currently queried category, tag or any other custom taxonomy term
    • User: allows to use the data of the current website user (guest, admin, customer, etc.)
    • WordPress: access to global WordPress data
  • Plugins
    • Advanced Custom Fields: access any custom field you've added to the currently queried page with ACF plugin
    • WooCommerce: huge amount of various data from your WooCommerce plugin. For example, product and product category data, WC shortcodes and more.

Easy to extend

Dynamic Shortcode Values component provides an easy way extending its functionality. Starting from filtering existing parts and ending with extending it with custom functionality pieces.

This is a great way to adjust values if your theme has unique features or delivers standard features in non-standard way.

It is also a wonderful possibility for Plugin and Theme developers to add support for their products.

Fallback

You have a possibility to decide also what to do if the replacement value is not available, which could be a case under different circumstances. There are 3 options:

  • Remove attribute or placeholder: when a value is not available, it will completely remove the attribute or placeholder from your shortcode, like it was never there
  • Clear attribute or placeholder: this will just empty the value
  • Remove this shortcode: in this case, the whole shortcode will not be rendered at all

Available as a standalone component in Visual Composer

While you may be using Dynamic Values to replace values in your existing shortcodes, sometimes you might need just to generate the dynamic value itself, without using any shortcode. For example, you may want to render sidebar, theme template or any WooCommerce shortcode. For this purpose, you'll find a "Dynamic Value" component in your Visual Composer editor.

Recent Posts