Title: Run Javascript on Certain Posts
Last modified: April 11, 2020

---

# Run Javascript on Certain Posts

 *  Resolved [nevrsmer](https://wordpress.org/support/users/nevrsmer/)
 * (@nevrsmer)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/)
 * Hello,
 * Can I use this plugin to run Pinterest’s “Pin It” code on certain posts instead
   globally? The way we have it now, Pin It appears on all images on all pages and
   posts on our site. We only want it to appear on the images on certain posts. 
   Also, these pages are created in Guttenberg and do have some Elementor script
   for some styling.
 * This is the script in question: “<script async defer data-pin-hover=”true” src
   =”//assets.pinterest.com/js/pinit.js”></script>”
 * Thank you for your help and have a good day.
 * Cheers!

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

 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/#post-12665896)
 * Hello.
 * The plugin has additional logic for displaying snippets. It works for all types
   of snippets except the PHP snippet.
 * > [View post on imgur.com](https://imgur.com/sXttNHq)
 *  [Giang Le](https://wordpress.org/support/users/gianghl1983/)
 * (@gianghl1983)
 * [6 years ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/#post-12808815)
 * [@webtemyk](https://wordpress.org/support/users/webtemyk/) Hi, I have the same
   question, just want snippets to be used in certain page (by ID/Slug/Name of that
   pages…).
 * I try Current Page condition without success (using ID, slug, page name…)
 * Do you have any guidance for this?
 * Thanks!
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [6 years ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/#post-12812832)
 * Hi, [@gianghl1983](https://wordpress.org/support/users/gianghl1983/)
 * Each item has a tooltip. [https://imgur.com/fZXLj4k](https://imgur.com/fZXLj4k)
   **
   Current Page** checks the URL of the page where the user is currently located.
   This is why you need to enter the URL. If you want to use for example a post 
   slug, select **Contains**
 *  [Giang Le](https://wordpress.org/support/users/gianghl1983/)
 * (@gianghl1983)
 * [6 years ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/#post-12813557)
 * [@webtemyk](https://wordpress.org/support/users/webtemyk/) Thank you! It worked
   flawlessly.

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

The topic ‘Run Javascript on Certain Posts’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Giang Le](https://wordpress.org/support/users/gianghl1983/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/run-javascript-on-certain-posts/#post-12813557)
 * Status: resolved