Title: Fallback for default thumbnail
Last modified: August 21, 2016

---

# Fallback for default thumbnail

 *  Resolved [M4trox](https://wordpress.org/support/users/m4trox/)
 * (@m4trox)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fallback-for-default-thumbnail/)
 * Hi guys,
 * I’m using a fallback when user didn’t use WordPress thumbnail to load custom 
   default thumbnail:
 *     ```
       <?php    if ( has_post_thumbnail() )    the_post_thumbnail('thumbnail');  else echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'images/defaul.png' . '" alt="" height="320" />'; ?>
       ```
   
 * However, I would like to implement this also in RPWE widget. Any idea how can
   I do this?
 * [http://wordpress.org/plugins/recent-posts-widget-extended/](http://wordpress.org/plugins/recent-posts-widget-extended/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [satrya](https://wordpress.org/support/users/satrya/)
 * (@satrya)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fallback-for-default-thumbnail/#post-3981463)
 * Hi, sorry for late reply.
 * Try this one
 *     ```
       <?php if ( has_post_thumbnail() && $thumb == true ) { ?>
   
       	<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'rpwe' ), the_title_attribute('echo=0' ) ); ?>" rel="bookmark">
       		<?php
       		if ( current_theme_supports( 'get-the-image' ) )
       			get_the_image( array( 'meta_key' => 'Thumbnail', 'height' => $thumb_height, 'width' => $thumb_width, 'image_class' => 'rpwe-alignleft', 'link_to_post' => false ) );
       		else
       			the_post_thumbnail( array( $thumb_height, $thumb_width ), array( 'class' => 'rpwe-alignleft', 'alt' => esc_attr(get_the_title() ), 'title' => esc_attr( get_the_title() ) ) );
       		?>
       	</a>
   
       <?php } else { ?>
   
       	<?php echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'images/defaul.png' . '" alt="" height="320" />'; ?>
   
       <?php } ?>
       ```
   
 *  Plugin Author [satrya](https://wordpress.org/support/users/satrya/)
 * (@satrya)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fallback-for-default-thumbnail/#post-3981467)
 * Please update to 0.8, I added option to show default thumbnail

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fallback for default thumbnail’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/recent-posts-widget-extended_3384ca.
   svg)
 * [Recent Posts Widget Extended](https://wordpress.org/plugins/recent-posts-widget-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/recent-posts-widget-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/recent-posts-widget-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/recent-posts-widget-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/recent-posts-widget-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/recent-posts-widget-extended/reviews/)

## Tags

 * [default thumbnail](https://wordpress.org/support/topic-tag/default-thumbnail/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * 2 replies
 * 2 participants
 * Last reply from: [satrya](https://wordpress.org/support/users/satrya/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/fallback-for-default-thumbnail/#post-3981467)
 * Status: resolved