Title: Adding javascript to a single page
Last modified: August 30, 2016

---

# Adding javascript to a single page

 *  [Vadim](https://wordpress.org/support/users/vadikcoma/)
 * (@vadikcoma)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/adding-javascript-to-a-single-page-2/)
 * Hi guys, how to add javascript to a single page of my website?
 * Here is the script
 * ========
 * <!– BEGIN JIVOSITE CODE {literal} –>
    <script type=’text/javascript’> (function(){
   var widget_id = ‘XXXXXXXXX’; var s = document.createElement(‘script’); s.type
   = ‘text/javascript’; s.async = true; s.src = ‘//code.jivosite.com/script/widget/’
   +widget_id; var ss = document.getElementsByTagName(‘script’)[0]; ss.parentNode.
   insertBefore(s, ss);})();</script> <!– {/literal} END JIVOSITE CODE –>
 * ========
 * Here is page – [https://www.coma.lv/wordpress-website-development/](https://www.coma.lv/wordpress-website-development/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Muhammad Ismail](https://wordpress.org/support/users/warmarks/)
 * (@warmarks)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/adding-javascript-to-a-single-page-2/#post-6716374)
 * Hi,
 * I suggest create a custom page template which has exact php code as per your 
   current page.php theme file. However you add above JS code just before the footer
   php tag.
 * Then apply that custom Page template to your page you want to add this JS.
 *  Thread Starter [Vadim](https://wordpress.org/support/users/vadikcoma/)
 * (@vadikcoma)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/adding-javascript-to-a-single-page-2/#post-6716453)
 * Thanks! Did that, now I have my page rendered via custom template
 * Page – [https://www.coma.lv/wordpress-website-development/](https://www.coma.lv/wordpress-website-development/)
   rendered via page-8427.php. But I couldnt get JavaScript to work. When I just
   copy-paste code to template, I get 500 error. I assume I need to do it in some
   other way
 *  [frannyj](https://wordpress.org/support/users/frannyj/)
 * (@frannyj)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/adding-javascript-to-a-single-page-2/#post-6716572)
 * The following link explains what you need (and also explains what doesn’t work
   and WHY).
 * [https://wordpress.org/support/topic/selectively-loading-javascript-files-by-page](https://wordpress.org/support/topic/selectively-loading-javascript-files-by-page)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding javascript to a single page’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [single-page](https://wordpress.org/support/topic-tag/single-page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [frannyj](https://wordpress.org/support/users/frannyj/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/adding-javascript-to-a-single-page-2/#post-6716572)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
