Default thumb fallback – how to set it
-
I want to remove default thumb plus plugin which is using a lot of resourses on my site, for something i think could be done easily without it. So i want to add a code which will generate default thumb if none is available (featured image, video thumb and so on ).
Inside index php my code for this looks like this :
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?> <div class="widget-img"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('large-thumb'); ?></a> </div> </div>
And i tried a lot of things but getting errors or nothing happens when i try something like this
This is the code which i found that should work but i cant find a proper way to mix it ( i am newbie)
`
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
?>
<img src=”<?php echo get_template_directory_uri(); ?>/images/default-thumb.jpg” />
<?php
}
?>Any help pls..thanks in advance
- The topic ‘Default thumb fallback – how to set it’ is closed to new replies.