I have the following code, what I am expecting it to do is locate the theme I am using and place that path before the /images/bg.png so far I just get the location which is localhost/nameoffolder/images/bg.png but what i want is localhost/nameoffolder/wp-content/themes/images/bg.png
<img src="<?php get_template_directory(); ?>/images/bg.png"></img>
this is the directory I would like to display
http://localhost:8888/fiftyfity/wp-content/themes/fiftyfity/images/
I used this code instead and it worked
<img src="<?php bloginfo( 'template_directory' ); ?>/images/bg.png"></img>
get_template_directory() returns the directory, but it doesn't echo it.. so if you use it with echo it will work
<img src="<?php echo get_template_directory(); ?>/images/bg.png"></img>
but I will suggest to use get_template_directory_uri() instead, because above will not be portable ( windows use backward slashes as separator )
<img src="<?php echo get_template_directory_uri(); ?>/images/bg.png"></img>
that's odd... Can you try get_stylesheet_directory() instead and see what that returns?