How to execute WP shortcode in a javascript string “”

Question

I would like to insert and execute some WordPress shortcode through main.js file, in a string “”, but the problem is that it won’t execute!

Here is an example of my main.js:

..
},
"March 6": {
    "title": "6 March",
    "subtitle": "Sample text",
    "content": "[sc name="sampleshortcode"]"
},
..

So with this, I see only [sc name="sampleshortcode"] as executed on my WordPress page.

Looking to find the solution to show WordPress shortcode through “string”. Or any other idea.

0
Veljko V. 1 month 0 Answers 14 views 0

Leave an answer