Plugin Directory

Changeset 552402


Ignore:
Timestamp:
06/03/2012 02:25:27 AM (14 years ago)
Author:
abelcreative
Message:

Widget will now automatically grab the featured image of the parent page is no featured image is defined.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • featured-image-widget/trunk/index.php

    r284359 r552402  
    4949            echo get_the_post_thumbnail($post->ID, $size);
    5050            echo $after_widget;
     51        } elseif (!has_post_thumbnail($post->ID) || $post->post_parent) {
     52            $title = apply_filters('widget_title', $instance['title']);
     53            echo $before_widget;
     54            if ( $title ) echo $before_title . $title . $after_title;
     55            echo get_the_post_thumbnail($post->post_parent, $size);
     56            echo $after_widget;
    5157        } else {
    5258            // the current post lacks a thumbnail, we do nothing?
Note: See TracChangeset for help on using the changeset viewer.