Support » Everything else WordPress » Relative URL doesn’t work.

  • Resolved Jayjerome


    I’m calling an image into my sidebar (from sidebar.php) but have to use the full Absolute URL to make it appear.
    The relative URL address doesn’t seem to work.

    The loooooonnnnnnngggggg Absolute address is :
    ‘<img src=”http://localhost/wordpress/wp-content/themes/MistyLook/img/todaysspin.png” alt=”Today’s Spin”>’

    So far, I’ve tried all the following variations of the Relative HTML address, unsuccessfully:
    ‘<img src=”img/todaysspin.png”‘
    ‘<img src=”/img/todaysspin.png”‘
    ‘<img src=”./img/todaysspin.png”‘
    ‘<img src=”../img/todaysspin.png”‘
    ‘<img src=”mistylook/img/todaysspin.png”‘
    ‘<img src=”/mistylook/img/todaysspin.png”‘

    Am I missing a period or a comma or something?

Viewing 3 replies - 1 through 3 (of 3 total)
  • If your page is in http://localhost/wordpress/wp-content/themes/MistyLook/
    <img src=”img/todaysspin.png”> should do it (did you forget the closing >)?

    The ‘relative’ address that might work is:

    <img src="wp-content/themes/MistyLook/img/todaysspin.png"

    The file path will be handled relative to the current directory one is at; and by that I don’t mean the template file, but you and your web browser.

    One way to handle this in templates is to use the bloginfo() template tag like so:

    <img src="<?php bloginfo('template_dir'); ?>/img/todaysspin.png"

    This will produce an absolute url to the image, but dynamically (so you don’t need to edit it whenever you move things, etc.).

    the ‘<img src=”wp-content/.. etc”> worked…

    thanks for the help.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Relative URL doesn’t work.’ is closed to new replies.