Image file path when building on local server? (6 posts)

  1. mellyg
    Posted 3 years ago #


    I'm sure this is fairly simple but I cant seem to make it work.

    Building on local server and have my images in the images folder of the theme, but not sure which file path to use in the code.

    Have tried <img src="/wp-content/themes/Anaximander-Static/images/partners.jpeg" width="500" height="500" alt=""/>

    But not working, any one have any idea what to do, also will all the paths be broken once it goes live on the site?

  2. keesiemeijer
    Posted 3 years ago #

    Consider echoing get_template_directory_uri() instead (for the parent template directory) or get_stylesheet_directory_uri() (for the child template directory).

    <img src="<?php echo get_template_directory_uri(); ?>/images/partners.jpeg" width="500" height="500" alt=""/>
  3. mellyg
    Posted 3 years ago #

    Heya, thanks for getting back, I have tried this and I am still coming up with a broken link. Any idea what might be the problem?

  4. keesiemeijer
    Posted 3 years ago #

    How does it look in the browsers source code?

  5. mellyg
    Posted 2 years ago #

    Hiya, late reply but I wasn't sure how to answer the question. If I upload images via the media uploader it works, below is one of the file paths - but these of course won't work once I upload to the server.

    Does that answer your question, and do you know what I am doing wrong?

    <img src="http://localhost:8888/wp-content/uploads/2013/08/quality_matters_logo.png">

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    This is why you need to follow the relevant steps in Moving_WordPress when it is time to move your site.

Topic Closed

This topic has been closed to new replies.

About this Topic