Custom Dynamic Content based on Shortcode

Hi there,

I’ve got a custom shortcode written to return a number, it goes: [my_shortcode type="foo"]. It works great with Headline elements, but with Counters it doesn’t seem to accept the shortcode as an input.

I know that Cornerstone/Pro recently added the option to use these ‘dynamic content’ inputs, which have a similar syntax, e.g. {{dc:woocommerce:product_price product="111"}} to display the product_price of a woocommerce product with a product_id of 11.

Where could I hook in to create custom ‘dynamic content’ options, so that I could use {{dc:custom:my_shortcode type="foo"}} to output that specific (dynamic) number to a Counter element, and other Cornerstone elements?

Thanks!

Hello @skndal,

Thanks for writing in! By default, only number values were allowed in the Counter element. You cannot insert a custom shortcode. The dynamic content also do not accept a custom shortcode. We do not have any hook or filter that you can use. You will need to create your own Class to extend the functionality of the Dynamic Content. You can check out how it was implement in the wp-content/plugins/cornerstone/includes/classes/dynamic-content/class-dynamic-content-global.php file. This is the easiest example that you can check to get your modifications needed.

Keep in mind that custom coding is beyond the scope of our support. We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One or Elite service for further assistance.

Thank you for your understanding.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.