Default featured image

Posted in: Newspaper
Post count: 5

Hi Newspaper Team!
I have a question:
How to add a default featured image to all post that does not have images on it?

Website: http://www.elversiculodeldia.com/

Post count: 5

Hi,
In this file single_template_4.php, Im editing these lines:

<?php
//if we have a featured image, show it
if (!empty($td_post_featured_image)) { ?>

<div class="td-big-slide-background"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>

<!-- preload the image -->
" alt="" style="display:none;"/>
<?php

td_js_buffer::add_to_footer(
'jQuery().ready(function() {' . "\r\n" .
'jQuery("#td-full-screen-header-image").backstretch("' . $td_post_featured_image . '", {fade:1200, centeredY:false});' . "\r\n" .
'});'
);
}
else {
echo '';
}

?>

But it does not having the same efects, how can I set it to work?

Thanks in avance!

Post count: 1291

Hi,

You could use a plugin which sets the first image from each post (which doesn’t have a featured image) as a featured image.
Or you could enable the image placeholder from Theme Panel -> Post Settings -> Featured image – http://screencast.com/t/05xbAXNKW1
You can replace the image with your own – http://screencast.com/t/OyMmwTGGsHxX

Thank you, Emil G.

Post count: 24

Hello there!
I have a specific problem. All images hosted on my server is accidentally deleted and now I have thousand article with broken (featured) link images. I have tried Image placeholder option as you mentioned above, but in vain. Only if I manually delete featured images, image placeholder is shown.
What to do? :/

Post count: 6600

Hi,

You can remove this code: http://screencast.com/t/GPmfShRoEt – this will display just the placeholder even if the post has a featured image set.

Thanks

Post count: 24

Hi Lucinan!

Thanks for reply! And I have to do this job every time when I update theme?

Thanks in advance

Post count: 24

Unfortunately, this solution doesn’t work. It shows only placeholder thumbs even for articles which have featured image.

I want to make clear: Image placeholder doesn’t work if featured images is setted but missing.

  • This reply was modified 11 years by Sandall.
Post count: 9544

You might try the plugin I use a lot … Auto Post Thumbnail Pro (on Envato) … it will create a new thumbnail and set as ‘featured’ based on first image in post, even if external image. I use it on all our sites as most of ours pre-date the use of ‘feautured’ image in WP, and so it’s an awesome tool. Might or might not be what you’re looking for, but it’s cheap. 🙂

Post count: 24

Thank you for reply, Chris! But my posts don’t have any images in it. All images folder in wp-content has deleted and can’t be restored.

Post count: 9544

Ah, well Auto Post Thumbnail Pro also allows you to assign a default image to all posts and make that the featured image. Worth a look (I have not monetary interest in the plugin).

Post count: 24

Thank you for your support, Chris. I have no doubt that this is the grat plugin, but despite all, I decided manually to remove all links and use Image placeholder from Tagdiv. I prefere the simplest solutions.
Issue solved 😀

Thanks again!

Post count: 9544

Cool… Well you posted the solution didnt work, so was suggesting a fix to set a featured image for posts without a featured image, and which fixes it permanently for wordpress and not theme specific.

Cheers.

Post count: 322

@sandall Once the featured images are missing at the file level, the default image from the theme won’t work because the database still shows a featured is set, even though the file is missing.

I’ve been through something similar with imports and I was not able to find anything that could bulk modify the posts in question. You have to manually go through each post and unset the featured image. Another may be an SQL query to remove the featured image info from each post at the database level, but that’s advanced and needs to be undertaken by someone familiar with WordPress and MySQL.

Wish there was an easy fix for this. Good luck!

Viewing 13 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic.