Firstly, I am hopeless with Javascript and have no idea about JSON.

I am currently building a website and incorporating particles.js into the design. I am at a loss, however, after searching for days, as to how I can call the get_stylesheet_directory_uri() function into the JSON configuration file.

I was able to figure out how to do it in the particles.js and particles-app.js by declaring a js variable in the header.php file globally, but as for JSON, I have no idea.

This is where I need to call this:

  "image": {
    "src": "sprites/blueBlur.png",
    "width": 100,
    "height": 100

If I leave it as is, it points only to the root WordPress file.


Read more here: How do I call WordPress get_stylesheet_directory_uri() in JSON file


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: