Created
December 31, 2016 19:58
-
-
Save mateusneves/464d0442ed6586bd90afb2440bfcca87 to your computer and use it in GitHub Desktop.
Set a default thumbnail if post dont have one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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