I have recently been trying to establish a working method of developing Wordpress sites locally by making use of an XAMPP server. The issue is that any images that I attempt to use refuse to show up when I load the page in a browser. I'm using the <?php echo get_template_directory(); ?>/library/images/name_of_the_svg_image file path, and when you right click and find them in the browser inspector HTML them shows the source as: C:\Program Files\xampp\htdocs\wp/wp-content/themes/**Site name**/library/images/name_of_the_svg_image Which, when I copy and paste it into the browser, shows the image properly. Is there something obvious that I am missing here?

2 Answers 2


get_template_directory() Retrieves the absolute path to the directory of the current theme, without the trailing slash.

You should use get_template_directory_uri(); for showing correct image path on site.

echo get_template_directory();?>/library/images/name_of_the_svg_image will work in your case.

Details here


use bloginfo('template_url')

<?php echo bloginfo('template_url'); ?>/library/images/name_of_the_svg_image

you need a url... not directory...

more on bloginfo here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.