WordPress.org

Ready to get started?Download WordPress

Forums

Recent Posts Widget Extended
[resolved] Fallback for default thumbnail (3 posts)

  1. M4trox
    Member
    Posted 1 year ago #

    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/

  2. Satrya
    Member
    Plugin Author

    Posted 1 year ago #

    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 } ?>
  3. Satrya
    Member
    Plugin Author

    Posted 1 year ago #

    Please update to 0.8, I added option to show default thumbnail

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic