Skip to content

Instantly share code, notes, and snippets.

@asathoor
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asathoor/c0fa01d8ae7a9ead9e87 to your computer and use it in GitHub Desktop.
Save asathoor/c0fa01d8ae7a9ead9e87 to your computer and use it in GitHub Desktop.
Images in a WordPress theme or child theme - several methods
<!-- in case of problems with displaying the images chmod 777 and chown daemon:daemon -->
<!-- link to media files -->
<p>
<img src="http://localhost/test/wordpress/wp-content/uploads/2015/03/cropped-download-1.jpg" width="200" height="*">
<p>
<!-- image in the template folder -->
<p>
<img src="<?php bloginfo('stylesheet_directory');?>/images/car.jpg"/ >
</p>
<!-- via CSS -->
<div id="anImage"></div>
<!-- the stylesheet -->
<style>
#anImage {
background-image: url(images/car.jpg);
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment