diff --git a/widgets/LatestThumbnailWidget.inc b/widgets/LatestThumbnailWidget.inc
index 57f44e9..77aee92 100644
--- a/widgets/LatestThumbnailWidget.inc
+++ b/widgets/LatestThumbnailWidget.inc
@@ -26,24 +26,37 @@ class ComicPressLatestThumbnailWidget extends WP_Widget {
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
- $latestcomics = get_posts('numberposts=1&category='.get_all_comic_categories_as_cat_string());
+ Protect();
+ $comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string();
+ query_posts($comic_query);
$archive_image = null;
-
- foreach($latestcomics as $post) :
- foreach (array("archive", "rss", "mini", "comic") as $type) {
- if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
- $archive_image = "";
- break;
+ if (have_posts()) {
+ while (have_posts()) : the_post();
+ if (!empty($post->post_content)) {
+ echo $before_widget;
+ $temp_query = $wp_query->is_single;
+ $wp_query->is_single = true;
+ foreach (array("archive", "rss", "mini", "comic") as $type) {
+ if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
+ $archive_image = "";
+ break;
+ }
+ }
+ if (function_exists('has_post_thumbnail')) {
+ if ( has_post_thumbnail($post->ID) ) {
+ $archive_image = get_the_post_thumbnail($post->ID,'full');
+ }
+ } ?>
+
+ is_single = $temp_query;
+ echo $after_widget;
}
- }
- if (function_exists('has_post_thumbnail')) {
- if ( has_post_thumbnail($post->ID) ) {
- $archive_image = get_the_post_thumbnail($post->ID,'full');
- }
- }
- ?>
-
-