I am trying to migrate a website i hand coded myself and i have to make it a wordpress theme now. I'm having trouble using the different images i've used throughout the index.html, they can't be loaded -getting a 404 error on the dev tools console-.

My question is, where should i put my images and how can I succesfully retrieve them in my new theme? do i put them all in an img/ folder? or do they have to be uploaded through media?

the images range from img tags, to embedded svg objects, examples:

<img src="img/Logos-crear.png">

<object>
    <embed src="img/icons/twitter.svg">
</object>

and background images using css:

.header .header-img {
    background: url("../img/main.jpg");
}

use this code and rename index.html to index.php.

<img src="<?php bloginfo('template_directory'); ?>/img/Logos-crear.png">
<object>
<embed src="<?php bloginfo('template_directory'); ?>/img/icons/twitter.svg">

that should work fine.no need to change in css code.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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