Adding a shortcode in CornerStone's JS panel

Hello,
We have a rewritten URL with parameters and want to pass them along to a page’s JavaScript. See below:

Is this possible somehow? (right now it outputs the shortcode as is)

Extra info; The shortcode works in text elements.

Hey Magik Web,

Unfortunately, that is not possible because the shortcode gets translated through PHP codes which cannot be done through Javascript.

You might want to add a hidden element on the page and place the value of the shortcode there through PHP then use Javascript to fetch the value from the element and set it to the input element.

Hope this helps.

1 Like

Yeah, that makes sense. It’s a little bit of gymnastics, but it’ll work for sure!
We’ll look into injecting that field directly through functions.php and if it fails, we’ll do exactly what you suggested.

Thank you!

You are most welcome. :slight_smile:

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