Adding an image to a custom template

Hi,

I have been trying to add an image to a custom template that displays only post from 1 category, with no success, all I get is the broken image/broken link symbol, see screenshot attached.

I have read almost every post on the internet about adding images to custom templates and I cannot find an answer to this.

I have just read a post in this forum by Aigars about the Child functions.php file as I am now starting to think it is more theme related than anything else, but it left me even more confused, as when I check the source for the Broken Image it gives me this.

http://www.bam-web-design.com/immo/wp-content/themes/dazzling/immo-service/images/line-break.png

And it says that the image Type is text/html instead of .png ???

The most perplexing part is the fact that is says dazzling in the string ??? I am using a child theme called immo-service so shouldn’t the reference to dazzling not be there ??

This is the code and src I am using in the template.

<img src="<?php echo get_bloginfo('template_url') ?>/immo-service/images/line-break.png"/>

Originally I was trying to access the image from an uploaded image in the Media files, when I couldn’t get that to work I created a folder in the child theme caled “images” and place the image in there and tried to link it to that.

Here is a link to the page where the broken link image shows, ignore the line that is showing there already, that was inserted directly into the post.

I am hoping someone can help me out with this.

Kindest Regards
Bam Bam

Hi Bam Bam,

I hope you are well today and thank you for your question.

You can try achieving it by replacing your shared code with the following code which worked fine for me on my test site using child theme.

<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/line-break.png"/>

Best Regards,
Movin

Movin,

Thanks that did the trick.

Kindest regards
Bam Bam

You are most welcome here :slight_smile: