WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Images won't appear on single & archive.php! But will in index! Why?? (7 posts)

  1. hanormsby
    Member
    Posted 4 years ago #

    Hey everyone,

    I've been working hard on my wordpress theme and a few things have suddenly stopped working and im unsure why.

    I'm working on it locally and everything is fine when viewing my main blog, but when I go to the individual posts (single.php) and archives pages, all the images won't load, including images in sidebar, header and blog... It's almost like the pages can't find my image folder, which is located in the root folder of my blog (where wp-config.php is).

    But why would this be if my index page is fine, when the code is practically the same?!

    I've tried duplicating the image folder to the theme folder and that doesn't work. Maybe i'm missing something obvious...

    Please help! I will be so grateful! I can try to clarify this more if it doesn't make sense...

    Thankyou x

  2. gbaka
    Member
    Posted 4 years ago #

    maybe you don't have the header and sidebars initiated on your theme or they have different headers and sidebars for single.php and archive.php.

  3. hanormsby
    Member
    Posted 4 years ago #

    No, because the content from the sidebar is still appearing, same with the header, it's just the images are not loading.

    Again, they don't have different headers/sidebars, as they content is all the same and there is only one copy of each file.

    Thankyou very much for the response! Any other ideas anyone?

  4. gbaka
    Member
    Posted 4 years ago #

    could you give me a link to see it?

  5. hanormsby
    Member
    Posted 4 years ago #

    of course!

    http://www.hanormsby.co.uk/blog

    and then click on the post, or the archive page or category, eg...

    http://www.hanormsby.co.uk/blog/2009/11/the-re-launch-of-hanormsby-co-uk-tada/

    Thankyou!!

  6. alchymyth
    Forum Moderator
    Posted 4 years ago #

    you are using relative links to the images, relative to the current page url, and this is diferent for each page.

    better use absolute reference, for instance getting the blog url from wordpress:

    <img src="<?php bloginfo('wpurl'); ?>/images/temptext.png" />

    see codex

  7. hanormsby
    Member
    Posted 4 years ago #

    GREAT! That makes sense, and it works now, Thankyou so much!

Topic Closed

This topic has been closed to new replies.

About this Topic