img — Get the URL to a local image file.¶
img() is a helper function used to include an image from within a theme. It returns the URL to an image file located in the images directory of that theme, usually located in themes/YourTheme/images. The resulting path can be used in an <img> tag, or anywhere else an image URL is needed.
img($file, $dir = 'images')¶
Get the URL to a local image file.
- $file (string) – Filename, including the extension.
- $dir (string) – Directory within the theme to look for image files. Defaults to ‘images’.
img() to include a link to an image stored in
<?php $themeScreenshot = img('fallback-theme.png'); ?> <div class="screenshot"> <img src="<?php echo $themeScreenshot; ?>" /> </div>