Use JavaScript in WordPress Pages and Posts
Over the years I have seen so many comments, articles and forum topics relating to the difficulty of running JavaScript (and PHP) within WordPress Pages and Posts. There of course are very many reasons why some script may be required to be included in WordPress content although there are often Plugins available (for free use/GPL) that will fulfil the requirements i.e. without having to include code / script directly in the Page or Post. This
fallacy about scripting difficulties within WordPress must stop!
In light of the misconception that JavaScript is difficult to run within WordPress Pages and Posts I have decided to demonstrate that WordPress does in fact run scripts very well within Posts and Pages. I have setup the WordPress Website http://xfn.com.au that includes various free Tools to showcase scripts put/injected into Pages. For best practice (and Page Speed) purposes the JavaScript (and PHP where applicable) is placed in the footer of the Page just before the closing </body> html tag. At present the JavaScript is in the Page itself rather than in an external file although I may start to use external .js and .php files for some scripts. In the case of JavaScript, wherever practical, the script is compressed using the awesome Google Closure Compiler.
JavaScript, PHP and many other common client-side and server-side scripting run very well within WordPress pages and Posts. Try it, you’ll be surprised!



