I need to get the URL of my theme directory to reference an image in the theme's image/headers directory. How is this done in PHP?
This function will return the theme directory URL so you can use it in other functions:
Alternatively, this function will echo the theme directory URL to the browser:
So an example for an image in the themes
What @EAMann said, with a caveat. Eric is right about the general approach and how the functions
However there is a caveat and that caveat is with the newer Child Themes. If you are using a child theme then
To illustrate the point I wrote a quick standalone file you can drop in your website's root as
If you notice things you might notice that there's a lot more to what you can pass to
Looking at the screenshot you can see that
By the way, in case you are not familiar with Child Themes where are two other WordPress Answers that might help:
The whole structure of theme builds on top of two options -
Now the only thing is missing is to combine those with themes folder location. This can be done with
protected by toscho♦ Jun 8 '12 at 11:48
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?