This is how i am loading the post thumbnail image ?
What if there is no image, i want to show a default image ?
How can i show that.
Here is the code i use to display thumbnail.
$html .= '<div class="post event" id="post-'.$post->ID.'">
<a href="'.get_permalink($post->ID).'"> '.get_the_post_thumbnail().' </a>
<div class="content">
<span class="title">
<a title="'.$post->post_title.'" href="'.get_permalink($post->ID).'">'.$post->post_title.'</a>
</span>
<div class="addl-123">';
$terms = wp_get_post_terms($post->ID, 'sublocation');
if($terms)
{
$out = array();
foreach ($terms as $term)
{
$out[] = '<a class="' .$term->slug .'" href="' .get_term_link( $term->slug, 'sublocation') .'">' .$term->name .'</a>';
}
//echo join( ', ', $out);
$html .= join( ', ', $out);
}
if($is_parent != 0)
{
$address = get_post_meta($is_parent,'address',true);
}
else
{
$address = get_post_meta($post->ID,'address',true);
}
if(!$address){ $address='-'; }
if($address && $address!="-"){$html .= "<b>".$address."</b>";}
$html .= '<p>Timinigs: '.get_post_meta($post->ID, 'cstimings', true). ' </p>';
$html .= '</div>
On line no 2 of code, i am able to display thumbnail of posts who have featured images. but for other posts there are no featured images. so, for such posts i want to display default image.
How can i do that ?