From 5ff967308ef61713300e0752d2f0af0fbfb7ce6a Mon Sep 17 00:00:00 2001 From: "Philip M. Hofer (Frumph)" Date: Sat, 23 Jan 2010 03:45:41 -0800 Subject: [PATCH] put the protect back in layout-head.php and adjusted ComicBlogPostWidget.inc to get the right info. Signed-off-by: Philip M. Hofer (Frumph) --- layout-head.php | 7 ++++-- widgets/ComicBlogPostWidget.inc | 40 ++++++++------------------------- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/layout-head.php b/layout-head.php index 10af445..f42fd64 100644 --- a/layout-head.php +++ b/layout-head.php @@ -21,10 +21,10 @@ is_single; @@ -34,6 +34,9 @@ $temp_single = null; endwhile; } + Restore(); + UnProtect(); + wp_reset_query(); } } else { if (is_single() && in_comic_category()) { diff --git a/widgets/ComicBlogPostWidget.inc b/widgets/ComicBlogPostWidget.inc index a79e3ce..1feb9d7 100644 --- a/widgets/ComicBlogPostWidget.inc +++ b/widgets/ComicBlogPostWidget.inc @@ -7,7 +7,7 @@ Author: Philip M. Hofer (Frumph) Version: 1.05 Author URI: http://frumph.net/ -*/ +*/ class ComicPressComicBlogPostWidget extends WP_Widget { @@ -20,37 +20,15 @@ class ComicPressComicBlogPostWidget extends WP_Widget { function widget($args, $instance) { global $post, $wp_query; - if (!is_home() && $instance['onlyhome'] || (is_page() || is_archive() || is_search())) return; + if (!is_home() && $instance['onlyhome']) return; + if (is_page() || is_search() || is_archive()) return; extract($args, EXTR_SKIP); - if (is_home()) { - Protect(); - $comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string(); - $posts = query_posts($comic_query); - 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; - $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); - if ( !empty( $title ) ) { echo "
".$title."
\r\n"; } - the_content(); - $wp_query->is_single = $temp_query; - echo $after_widget; - } - endwhile; - } - Restore(); - UnProtect(); - wp_reset_query(); - } else { - if (!empty($post->post_content)) { - echo $before_widget; - $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); - if ( !empty( $title ) ) { echo "
".$title."
\r\n"; } - the_content(); - echo $after_widget; - } + if (!empty($post->post_content)) { + echo $before_widget; + $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); + if ( !empty( $title ) ) { echo "
".$title."
\r\n"; } + the_content(); + echo $after_widget; } }