Title: template tag in js script
Last modified: February 1, 2023

---

# template tag in js script

 *  Resolved [cameraspots1](https://wordpress.org/support/users/cameraspots1/)
 * (@cameraspots1)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/)
 * Hello, is it possible to paste the template tag in a js script? to get the json
   directly from the template tag?
 * normal with getJSON or VAR , can you tell me for example how to put the tag in
   the script (example)

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

 *  Thread Starter [cameraspots1](https://wordpress.org/support/users/cameraspots1/)
 * (@cameraspots1)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/#post-16430765)
 * I mean i need a json file from an api. But i can only make wordpress page files
   and php files. Can i make a json file too?
 *  Plugin Author [WPGetAPI](https://wordpress.org/support/users/wpgetapi/)
 * (@wpgetapi)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/#post-16432200)
 * Hi there,
 * No it is not possible for it to go into JS code. It is a PHP function and only
   works with PHP.
 * I’m not 100% sure I follow what you are wanting to do though.
 *  Thread Starter [cameraspots1](https://wordpress.org/support/users/cameraspots1/)
 * (@cameraspots1)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/#post-16433154)
 * No problem, it already worked. I have been using a php file instead of snippets
   plugin.
 *  Plugin Author [WPGetAPI](https://wordpress.org/support/users/wpgetapi/)
 * (@wpgetapi)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/#post-16435222)
 * Ok great.

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

The topic ‘template tag in js script’ is closed to new replies.

 * ![](https://ps.w.org/wpgetapi/assets/icon-256x256.jpg?rev=2848998)
 * [WPGet API - Connect to any external REST API](https://wordpress.org/plugins/wpgetapi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpgetapi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpgetapi/)
 * [Active Topics](https://wordpress.org/support/plugin/wpgetapi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpgetapi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpgetapi/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [WPGetAPI](https://wordpress.org/support/users/wpgetapi/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/template-tag-in-js-script/#post-16435222)
 * Status: resolved