Forums

[resolved] Inserting images into templates (3 posts)

  1. Anonymous
    Unregistered
    Posted 1 year ago #

    New user here - I'm just really messing about with the default template to get a sense of what's what.

    The thing which has me really stumped tonight is that if I try to insert an image into the template using an <img> tag, it does not show up on the page. I put a small image into the "image" folder in the template and tried to insert it in various places in the template, like this:

    <img src="images/cellphone.jpg" />

    ..but it won't display. I've tried it in the header, the content, the navigation - everywhere. Can anyone explain to me what's going on? Do I have the path wrong or something like that? I tried using an absolute path but that didn't work either.

  2. educationthemes
    Member
    Posted 1 year ago #

    You need to use the absolute link. Replace it with this instead:

    <img src="<?php bloginfo('template_url'); ?>/images/cellphone.jpg" />

    The first php code gets the URL of the template which gives it an absolute link.

  3. Anonymous
    Unregistered
    Posted 1 year ago #

    Aha! Beautiful. Thank you, the rest of my hair is safe.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.