I’m trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I’ve tried a number of plugins – Default Post Thumb and Default Thumb, however neither of these seemed to work. I’m using WP 3.4 and the Suffusion Theme 4.2.2 on the site which can be seen at http://www.aliveradio.net/ I’m not very capable at editing basecode and would prefer to work with plugins, however if anyone could help with code alterations I’d be happy to give it a go.
Thank-you in advance for any help you can provide.
One simple method is to filter
post_thumbnail_html
, to add in a default image link:You can make this filter more complex, but this should get you started.
while you say you’d like to use a plugin … there is a very easy method to do what you want
basically inside your theme folder you will want to open and edit a file called single.php
you want to look for this code
and replace it with this code (changing the path_to/default_image.jpg)
If you find your site breaks / page doesn’t load then you may need to remove the the opening
source: http://www.wpbeginner.com/wp-themes/how-to-set-a-default-fallback-image-for-wordpress-post-thumbnails/
Hope that helps?
Cheers
Damien
You can use if and else statement to do this, all you need to do is to manipulate
the_post_thumbnail()
function.You can do it like this
You can take a look at http://techlog.xyz/how-to-set-default-featured-image-if-posts-has-none/