Solutions for generating dynamic Javascript / CSS

Posted by Prem Tiwari | Updated on

One additional option, depending on the kind of parameters you need to pass in. Let’s call it (2a). You can also create PHP scripts which output dynamically-generated text/css or text/javascript rather than text/html, and provide them the data that they need using GET parameters rather than by loading up WordPress. Of course this only works if you need to pass in a relatively small number of relatively compact parameters. So, for instance, say you need to pass in only the URL of a post or the directory of a file or similar, you can do something like this:

Add the below code in header.php file:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers