Support » Themes and Templates » img src not working

  • I’m new to wordpress, and trying to get how it works and how I can make my own theme, so far it’s ok, but the <img src=”link” /> code doesn’t work. Am I doing something wrong?

Viewing 12 replies - 1 through 12 (of 12 total)
  • I guess you are also new to HTML? The <img> tag is for images, and as long as the “link” goes to an image on the server it should work.

    Try pasting the URL to the image you are using in the browser, and if the image is displayed correctly it should work. If it’s not then you need to change the URL until it directs to the correct image. Can’t tell you any more without more info about the problem.

    How about posting the URL to the site?
    Makes analyzing the problem a bit easier for all of us.


    I’m not new to html. And yeah it’s for images, it’s for the header, normaly I use that code, but apparently it doesn’t work.

    The site is, I’m wokring on a new design for it, and it’s almost the same, and I’m trying to get it to work with wordpress, I’ve got it installe but not using it, been testing the themes a little but deleted them.

    But I used this code for the header <img src=”/images/02.jpg” alt=”02″ /> which is the header. I’ve also tried to make a div and get it through CSS, but still nothing, even checked out what other did when they had the same problem, but nothing then.

    One important thing to remember when using images to design with WordPress directly into the HTML is that the image folder is within the theme-folder, not the root (

    So if you are adding an image in header.php in the theme folder you need to write <img src=”<?php bloginfo(‘template_directory’); ?>/images/02.jpg” />

    It’s therefore generally smoother to add images in the stylesheet instead.

    Don’t know if that’s the problem.

    Ok, so I made a new theme here and used the code u suggested, but still nothing. These are is my codes:


    <link href="style.css" rel="stylesheet" type="text/css">
    <img src="<?php bloginfo('template_directory'); ?>/filer/02.jpg" alt="" />


    body {
    background-image: url("<?php bloginfo('template_directory'); ?>/filer/01.jpg");
    background-repeat: no-repeat;
    background-attachment: fixed;

    First of all, you can’t use PHP inside a CSS file, but that doesn’t matter on the result now.

    With the code you printed the image links to

    Which does not exist.

    Go to your FTP and check if in
    root > wordpress > wp-content > themes > v12 > filer
    there is an image named 02.jpg. There probably won’t be one.

    Haha, I thought I’d change the folder to images so it would be easier and forgot to change the code, but the CSS thing is something I read in another forum.

    But the header is showing now, but it’s wired cus I found that php code earlier in another post here, and tried it then, but it didn’t work. Typical that things start working when I ask, make it seem stupid 😛

    Anyway, what do I do with the CSS then? It’s not working :/

    Well, you could either just keep the image as HTML, or you could do it in CSS.

    <div id="logo"></div>

    #logo { background:url('images/02.jpg') left top no-repeat; width:900px; height:639px; }

    As WizardRegis mentioned, this should work:

    body {

    background-image: url(‘images/01.jpg’);
    background-repeat: no-repeat;
    background-attachment: fixed;


    as you have to get the path from where the *.css is located.

    Ok, thanks, slowly getting there. But do I just use normal CSS link, like <link href=”stylesheet.css” rel=”stylesheet” type=”text/css”> ?

    You would use (in your theme’s header.php)

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    which will use the style.css in your theme directory.

    If you wish to include additional CSS files use

    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/yourfile.css" type="text/css" />

    Thanks 😀

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘img src not working’ is closed to new replies.