Justin Tadlock wrote about the right ways to add default post thumbnails to your WordPress themes. One method is to filter on post_thumbnail_html
, and the second method is to simply use else
with has_post_thumbnail
.
The second method is easier to understand, straightforward and future-proof. The filter in the first method would only work well when we need to change the markup of the thumbnail images output, like print a div
with a background-image
instead of an img
element.