mateusneves
12/31/2016 - 7:58 PM

Set a default thumbnail if post dont have one

Set a default thumbnail if post dont have one

add_filter( 'post_thumbnail_html', 'qwp_featured_image_default', 10, 5 );

function qwp_featured_image_default($html){
  $default_thumb = foundation_q_get_option('website_default_thumb');
  $default_thumb_url = $default_thumb['thumbnail'];
  $default_thumb_id = $default_thumb['id'];

  if ( empty( $html ) ):
    $html = '<img src="' . $default_thumb_url . '" alt="" />';
  endif;

  return $html;
}