Skip to content

Instantly share code, notes, and snippets.

@mateusneves
Created December 31, 2016 19:58
Show Gist options
  • Save mateusneves/464d0442ed6586bd90afb2440bfcca87 to your computer and use it in GitHub Desktop.
Save mateusneves/464d0442ed6586bd90afb2440bfcca87 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment