From 6d5b487be672b130e990a5160524a64e54b270e0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 23 Jul 2009 19:33:16 -0400 Subject: [PATCH] change index blog posts to actually use Loop --- classes/ComicPress.inc | 11 ++--------- index.php | 6 ++++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 2b3e18c..1856428 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -332,7 +332,7 @@ class ComicPress { /** * Gather blog posts for the given index page. */ - function get_index_blog_posts() { + function get_index_blog_posts_query() { global $post, $paged; $t = $post; @@ -346,15 +346,8 @@ class ComicPress { '&paged=' . $paged ); - - $posts = array(); - if ($wp_query->have_posts()) { - while ($wp_query->have_posts()) { $wp_query->the_post(); $posts[] = $post; } - } - $post = $t; - - return $posts; + return $wp_query; } function _glob($pattern) { return glob($pattern); } diff --git a/index.php b/index.php index 98cb842..b9584f9 100644 --- a/index.php +++ b/index.php @@ -20,8 +20,10 @@ include_partial('index-blog-header'); - foreach ($comicpress->get_index_blog_posts() as $post) { - setup_postdata($post); + $index_posts_query = $comicpress->get_index_blog_posts_query(); + + while ($index_posts_query->have_posts()) { + $index_posts_query->the_post(); include_partial('index-blog-post'); }