WordPress.org

Forums

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

  1. mellyg
    Member
    Posted 1 year ago #

    Heya

    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
    moderator
    Posted 1 year 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
    Member
    Posted 1 year 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
    moderator
    Posted 1 year ago #

    How does it look in the browsers source code?
    http://www.wikihow.com/View-Source-Code

  5. mellyg
    Member
    Posted 1 year 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 1 year 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