How to find the theme path from within a javascript file of a theme in WordPress
-
Hi,
I am trying to figure out why I cannot find the path to an image I am trying to set within my js file. Here’s my setup..
footer.php
`<script language=”javascript” src=”<?php
bloginfo(‘template_directory’); ?>/js/scripts.js”></script>
</body>`themes/themename/js/scripts.js
`var imageUrl = “../images/sprite-site.png”;
$j(this).css(‘background-image’, ‘url(‘ + imageUrl + ‘)’);`I’ve tried 10 different options and none have worked so far.
I would appreciate some help with this please.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to find the theme path from within a javascript file of a theme in WordPress’ is closed to new replies.