From 8f254211e53df14abe43a18141450c86f90be6bd Mon Sep 17 00:00:00 2001 From: "Philip M. Hofer (Frumph)" Date: Sat, 23 Jan 2010 04:02:49 -0800 Subject: [PATCH] Index.php fix for not showing the proper blog posts in the right places. reverting ComicBlogPostWidget.inc Signed-off-by: Philip M. Hofer (Frumph) --- index.php | 9 +++++--- widgets/ComicBlogPostWidget.inc | 40 +++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/index.php b/index.php index 32449c9..2a9a36b 100644 --- a/index.php +++ b/index.php @@ -2,12 +2,15 @@ is_archive = false; if (have_posts()) { - comicpress_display_post(); + while (have_posts()) : the_post(); + comicpress_display_post(); + endwhile; } Restore(); UnProtect(); diff --git a/widgets/ComicBlogPostWidget.inc b/widgets/ComicBlogPostWidget.inc index 1feb9d7..a79e3ce 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,15 +20,37 @@ class ComicPressComicBlogPostWidget extends WP_Widget { function widget($args, $instance) { global $post, $wp_query; - if (!is_home() && $instance['onlyhome']) return; - if (is_page() || is_search() || is_archive()) return; + if (!is_home() && $instance['onlyhome'] || (is_page() || is_archive() || is_search())) return; extract($args, EXTR_SKIP); - 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 (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; + } } }