Categories: wordpress

How to overwrite “img src=(unknown)” in wordpress ?

I have recently shifted my site to another host by exporting the data. And I don’t have the original data. After shifting I knew the images were not properly exported and I didn’t get all the images. so I want to display my logo in those files where images source were unknown.

say my main image is original.jpg and if it does not display then i want to display missing.jpg which is inside images folder of my theme.

Syntax can be as follow

<img src="original.jpg" onError="this.onerror=null;this.src='<?php echo get_bloginfo('template_url');?>/images/missing.jpg';" />

 

If you use for thumbnail image you can use this

<img src="<?php echo get_the_post_thumbnail_url(); ?>" onError="this.onerror=null;this.src='<?php echo get_bloginfo('template_url');?>/images/themeimage.png';"/>

 

jaminrai

Recent Posts

Computer Science Project Report Guidelines and Sample

Guidelines (Click Below to Download) SAMPLE 1 SAMPLE 2

3 months ago

Skype Closes Its Doors After 20 Years: A Look Back and the Apps That Faded with It

After 20 years of transforming global communication, Skype has officially ceased operations. Microsoft, which purchased…

10 months ago

The Duck and the Tortoise: A Tale of Patience and Teamwork

In a serene forest by the edge of a sparkling lake, there lived a cheerful…

11 months ago