M
M
morgana_lf2015-11-06 21:38:04
WordPress
morgana_lf, 2015-11-06 21:38:04

How to set image path in wordpress?

Good afternoon, maybe someone has come across this. While the wordpress site was on a PC, everything worked fine, the template contained lines like:

<img src="<?php echo get_template_directory_uri() ?> /img.jpg" width="300">

Pictures loaded without problems.
After transferring the folder with the site to the hosting, the pictures, written in this way in the template, stopped loading. Everything else (including pictures from posts) works fine. What could be the problem and how to set the path correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor Vorotnev, 2015-11-07
@morgana_lf

if you have a child theme then use get_stylesheet_directory_uri()

N
neeil, 2015-11-06
@neeil

get_template_directory_uri()
Gets the path to the folder template, inside the template you need to explicitly specify in which folder of the picture

N
Noirman, 2015-11-07
@Noirman

Check the case of letters in image filenames. Linux hosts are very picky about this, unlike Win.
img.jpg != img.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question