How to add inline JavaScript to a WordPress template file?” Plus add it to every post on my page? for instance, <script type="text/javascript">alert('hello world');</script>
would be…
Leave a Reply
You must be logged in to post a comment.
How to add inline JavaScript to a WordPress template file?” Plus add it to every post on my page? for instance, <script type="text/javascript">alert('hello world');</script>
would be…
You must be logged in to post a comment.
Adding it to a template is easy; just stick it within a tag in any part of the template you want to add it to. For instance:
as an incredibly basic (and kinda messy and improper) way to demonstrate it. Any template file is just a PHP file, or in other words an HTML file with some extra PHP code thrown in.
Also, to add something to a post, you’ll want to add it to the appropriate part of your WordPress template. For instance, in the default Twentytwelve theme, that’d be the content.php file–that contains the code for a single article, and adding something to that will add it to every instance of an article on the page.