How do I get the theme URL in PHP?

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 images/headers folder would be:

<img src="<?php bloginfo("template_directory'); ?>/images/headers/image.jpg" />

Leave a Comment