All WordPress snippets
WordPress

Two Ways to Reference Theme Images in Templates

Two equivalent ways to build the path to an image sitting inside your theme folder, for use directly in template markup.

php
<img src="<?php bloginfo( 'stylesheet_directory' ); ?>/img/image.png" />

or



Want your own copy? Fork this repo and build your own snippet collection. Fork on GitHub →