WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. mellyg
    Member
    Posted 10 months 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 10 months 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 10 months 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 10 months ago #

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

  5. mellyg
    Member
    Posted 10 months 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 10 months ago #

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

Reply

You must log in to post.

About this Topic