Title: Background image &#8211; does not display
Last modified: August 21, 2016

---

# Background image – does not display

 *  Resolved [zed28](https://wordpress.org/support/users/zed28/)
 * (@zed28)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/background-image-does-not-display/)
 * Hi,
 * I am using this:
 * <div class=”smallblock-cont” style=”background-image: url(<?php echo get_template_directory_uri();?
   >/images/image.jpg)”>
 * to display background image on my localhost site.
    But image does not display.
 * Full path to images is:
 * [http://localhost/sitename/wp-content/themes/themename/images/image.jpg](http://localhost/sitename/wp-content/themes/themename/images/image.jpg)
 * I do not want use full path, because I do not want overwrite all image paths 
   when moving to webhosting.
    Relative paths “/images/image.jpg” dont work.
 * Can anybody help me?
 * Thanks
    Alex

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/background-image-does-not-display/#post-4387266)
 * Remove the ‘[echo](http://www.php.net/echo)‘, you are using get_template_directory_uri
   in a string in HTML, not printing it.
 * Also, where is this code added? In a page or post or a page template? ?
 *  Thread Starter [zed28](https://wordpress.org/support/users/zed28/)
 * (@zed28)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/background-image-does-not-display/#post-4387385)
 * Oh, my mistake. I did not know that I can not execute php code in page content.
   
   I must create new template file and put code there.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Background image – does not display’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [zed28](https://wordpress.org/support/users/zed28/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/background-image-does-not-display/#post-4387385)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
