Title: Javascript only on one page
Last modified: July 24, 2023

---

# Javascript only on one page

 *  Resolved [lowthian](https://wordpress.org/support/users/lowthian/)
 * (@lowthian)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/)
 * Greetings. Great plugin, very happy I purchased, looking forward to upcoming 
   releases as I’ve heard of some great new features.
   I am working with a script
   that I need to run only on the homepage. I have found the code for a function
   code to only run on single pages, but is there a way to load a javascript code
   only on a single page?Thanks.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-only-on-one-page%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [garybartram](https://wordpress.org/support/users/garybartram/)
 * (@garybartram)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-16972621)
 * This would be really helpful – same with CSS – to just add it to a single page.
   Surprised this isn’t an option. Did you find an answer to this?
 *  Thread Starter [lowthian](https://wordpress.org/support/users/lowthian/)
 * (@lowthian)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-16972824)
 * Not so far, I know the folks at code snippets are very busy right now, but I’m
   hoping one of them will jump on here and let me know if it’s going to be a feature,
   and if there’s some sort of method I can use for this purpose.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-16984673)
 * This is definitely planned for a future release. For the meantime, you can always
   write your CSS/JS code from within a PHP snippet and use [conditional tags](https://developer.wordpress.org/themes/basics/conditional-tags/)
   to determine when and where it is included on the page.
 *  Thread Starter [lowthian](https://wordpress.org/support/users/lowthian/)
 * (@lowthian)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-16990167)
 *  Thanks Shea,
 * Your link shows the php for including something, but this is a script. So I see
   a couple of ways to do it, either put the script right into a php snippet, or,
   write a php snippet that calls the script snippet. What do you recommend is the
   easiest way to accomplish this.
 * Excited about your upcoming releases!
    -  This reply was modified 2 years, 9 months ago by [lowthian](https://wordpress.org/support/users/lowthian/).
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-17093217)
 * Both are viable options – it’s really just down to the sort of code you want 
   to include.
 *  Thread Starter [lowthian](https://wordpress.org/support/users/lowthian/)
 * (@lowthian)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-17093967)
 * Hi Shea, thanks for your update.
   I guess what would be really nice to see in 
   a future release is something similar to what Elementor has for custom code where
   you can decide where you want it to run. If that is not doable, then how about
   a way to enter the post id(s) on the snippets?
 * Thanks,
   Geoffrey
 * ![](https://wordpress.org/ae9fa87e-8dbd-44f5-9c4c-1c980d2bf48d)
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-17097971)
 * We’re definitely planning on adding a conditional code feature in the near future.

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

The topic ‘Javascript only on one page’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/javascript-only-on-one-page/#post-17097971)
 * Status: resolved