Support » Plugin: Picturefill.WP » Featured image

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author kylereicks


    Good question.

    Short answer, no… or rather, you are correct in your assumption. The plugin wont look through images outside the_content, and I don’t plan on expanding it to hook into other filters by default.

    Longer answer, soon. Hooking and structuring the plugin to be easily extended by theme authors is the major goal of the next feature release. I will certainly take your question into account when thinking about extension use cases.

    Longest answer yes. Even though the current stable version of the plugin is not well hooked, you can still take advantage of some of it’s functions in your theme.

    If, for example, your post_thumbnail is the same size as your thumbnail, the following code in your functions.php file might just do the trick. (It’s working for me in a single test case, but I haven’t tested it extensively)

    add_filter('post_thumbnail_html', array('Picturefill_WP', 'replace_images'));
    add_filter('post_thumbnail_html', 'add_attachment_id_to_post_thumbnail_class', 9, 5);
    function add_attachment_id_to_post_thumbnail_class($html, $post_id, $post_thumbnail_id, $size, $attr){
       return preg_replace('/class="([^"]+)"/', 'class="$1 size-thumbnail wp-image-' . $post_thumbnail_id . '"',$html);

    If you are so inclined, give that a shot and let me know if it works for you. If not, I have another idea that we could try that target the post_thumbnails more directly, but I’d like to try it out myself before I post it as a possible solution.

    Plugin Author kylereicks


    I’m going to mark this issue as resolved with version 1.2.0

    See the [Extending Picturefill.WP]( subsection of the GitHub repository for an example of how to extend the plugin and add additional image sizes if desired.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Featured image’ is closed to new replies.