Title: Using wordpress variables in Javascript
Last modified: August 19, 2016

---

# Using wordpress variables in Javascript

 *  [fongchun](https://wordpress.org/support/users/fongchun/)
 * (@fongchun)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/using-wordpress-variables-in-javascript/)
 * Hi all,
 * Wasn’t sure where to post this, and I couldn’t find any posts about it. But I
   have a javascript function which relies on the path to the images folder in my
   theme’s directory. I usually do something like this in php,
 * `<?php bloginfo('template_url'); ?>/images/top_about_us_on2.jpg`
 * But because I am using javascript, I can’t just use the bloginfo(‘template_url’)
   function. Is there anyway I can still use it?
 * Thanks

Viewing 1 replies (of 1 total)

 *  [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * (@claytonjames)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/using-wordpress-variables-in-javascript/#post-1194091)
 * I’m taking a wild swing here, but will substituting ‘template_directory’ work
   and still avoid any conflicts, or doesn’t it work that way?
 * template_directory = [http://example/home/wp/wp-content/themes/largo](http://example/home/wp/wp-content/themes/largo)

Viewing 1 replies (of 1 total)

The topic ‘Using wordpress variables in Javascript’ is closed to new replies.

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/using-wordpress-variables-in-javascript/#post-1194091)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
