374 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rohan says
I think you originally meant “TEMPLATEPATH” not TEMPLATE _URL …

Nope, TEMPLATEPATH gives the actual file path – like /nfs/www/httpdocs/ blah blah. Not the www.domain.com type url.

1029 posts
  • Has referred 500+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
ThemeBlvd says
I think you originally meant “TEMPLATEPATH” not TEMPLATE _URL …
Nope, TEMPLATEPATH gives the actual file path – like /nfs/www/httpdocs/ blah blah. Not the www.domain.com type url.

I know…but I thought it would work in this case. I just looked at wp_enqueue_script() in the codex, and you’re right! ... needs to be a web url.

1 post
  • Has been part of the Envato Community for over 5 years
  • Has collected 1+ items on Envato Market
mattyza says

Hi All, I’d like to comment on the use of the TEMPLATE _URL constant.

As mentioned in my blog post on enqueueing JavaScript in WordPress, I have defined the TEMPLATE _URL constant for use in themes I develop. This is to create a re-usable value and to avoid multiple look-ups.

Adding the following to your theme’s functions.php file will resolve this:

define( 'TEMPLATE_URL', trailingslashit( get_stylesheet_directory_uri() ) );

Alternatively, replacing TEMPLATE _URL with trailingslashit( get_stylesheet_directory_uri() ) in your PHP code will achieve the same effect. :)

I hope this helps, guys.

All the best, Matty.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by