Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Created November 27, 2012 10:28
Show Gist options
  • Select an option

  • Save wokamoto/4153514 to your computer and use it in GitHub Desktop.

Select an option

Save wokamoto/4153514 to your computer and use it in GitHub Desktop.

Revisions

  1. wokamoto created this gist Nov 27, 2012.
    11 changes: 11 additions & 0 deletions thumbnail_noimage.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <?php
    function thumbnail_noimage($html, $post_id, $post_thumbnail_id, $size, $attr) {
    if (!empty($html))
    return $html;

    $post_thumbnail_id = 1234; // default thumbnail image id
    $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );

    return $html;
    }
    add_filter('post_thumbnail_html', 'thumbnail_noimage', 10, 5);