Forums

no images in theme (10 posts)

  1. hoktar
    Member
    Posted 1 year ago #

    Hi,
    I just tried to create my first own WP theme. Programmed the design in HTML and now I wanted to import it into an existing theme so I don't need to write a new one.

    But whenever I try to include a picture, WP just ignores it. No matter if it is a CSS bg image or an img tag, nothing works, it's just not there. There isn't even this little image that says there should be a picture but it can't be displayed, there is just nothing, like it wasn't in the code. But it is, not only in my source but also after it came from the server.

    The pictures from the theme get displayed perfectly well, only mine don't...

    It can't be because of the theme either, I tried 3 completely different themes including the original one.

    What is wrong here?

  2. hoktar
    Member
    Posted 1 year ago #

    Oh and I tried to put the images in the header, index and footer.php, nothing works.

  3. alchymyth
    The Sweeper
    Posted 1 year ago #

    likely, the file paths to the images are wrong ...
    or the images are not uploaded to the right location.

    just a guess, without a link to the site.

    btw: firefox for instance does not show little squares with red crosses for missing images.

  4. hoktar
    Member
    Posted 1 year ago #

    "firefox for instance does not show little squares with red crosses for missing images. "

    Damn, I thought so to, I haven't seen those little bastards for a while now :D

    But still, the path is correct, the images are in the standard "image" folder any theme usually has which is at the same level as the header.php. Therefore the path is "images/myimage.jpg" when I put it in header.php. But it doesn't work.

  5. alchymyth
    The Sweeper
    Posted 1 year ago #

    the standard "image" folder any theme usually has which is at the same level as the header.php

    wrong - the images folder is off the style.css level; relative file paths work only for the background images referenced in style.css.

    if you use images, including for css, in header.php or any other template files, you need to use absolute file paths, which is made easier by using bloginfo('template_url'):
    http://codex.wordpress.org/Function_Reference/bloginfo

    for instance in embedded styles in header.php:

    <style type="text/css" media="screen">
    #page { background: url(<?php bloginfo('template_url'); ?>/images/page_bg.jpg; }
    </style>
  6. hoktar
    Member
    Posted 1 year ago #

    EDIT

  7. hoktar
    Member
    Posted 1 year ago #

    Hail alchymyth for he is God.

    Thanks a lot dude, you saved my day!

  8. viperousmango
    Member
    Posted 1 year ago #

    Hey, I'm having some of the same problems experienced. I've tried the tips above but I'm still having no luck.

    This is what I want the theme to look like; but this is what I get.

    Any help would be appreciated, is there something wrong with my CSS coding?
    body { background: url(<?php bloginfo('template_url'); ?>/images/bg2.png); repeat-x #FFFFFF; font-size:12px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Arial, san-serif; color:#000000;}

  9. hoktar
    Member
    Posted 1 year ago #

    Is this code from your .css style sheet?
    Because then the paths need to be relative!

    So this should do it:

    body { background: url(images/bg2.png); repeat-x #FFFFFF; font-size:12px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Arial, san-serif; color:#000000;}

  10. viperousmango
    Member
    Posted 1 year ago #

    Awesome thank you! That did the trick.

Topic Closed

This topic has been closed to new replies.

About this Topic