Showing a placeholder/default img, if no featured image is set

Misspelling of thumbnail (thumnail) in the if statement.

Also get_the_post_thumbnail does echo the thumbnail, but just returns the html. You need to echo it.

Also, for checking if a post has a thumbnail, you can use has_post_thumbnail.

 if ( has_post_thumbnail($r->ID)) {
    echo get_the_post_thumbnail($r->ID, array(50,50));
 }else{
    echo '<img src="https://wordpress.stackexchange.com/questions/44208/image_url"/>';
 }

Leave a Comment