How to add images to a wordpress theme when working on MAMP? How to add images to a wordpress theme when working on MAMP? wordpress wordpress

How to add images to a wordpress theme when working on MAMP?


This works for me:

<img src="<?php echo get_bloginfo('template_url') ?>/images/logo.png"/>

See get bloginfo() function for more info.


You can use the following code to add an image. This works for me:

<img src="<?php echo get_template_directory_uri(); ?>/images/filename.png">


<?php echo get_template_directory_uri(); ?> 

as suggested gets the PARENT theme, which is OK but if you've developed a child theme (as recommended by WordPress people) you need:

<img src="<?php echo get_stylesheet_directory_uri(); ?>/img/Logo.png">