diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 3b44772..7af093f 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -326,6 +326,34 @@ class ComicPress { } return false; } + + /** + * Gather blog posts for the given index page. + */ + function get_index_blog_posts() { + global $post, $paged; + + $t = $post; + + $wp_query = new WP_Query(); + $wp_query->query( + 'showposts=' . + (int)$this->comicpress_options['blogpost_count'] . + '&cat=-' . + $this->comicpress_options['comic_category_id'] . + '&paged=' . + $paged + ); + + $posts = array(); + if ($wp_query->have_posts()) { + while ($wp_query->have_posts()) { $wp_query->the_post(); $posts[] = $post; } + } + + $post = $t; + + return $posts; + } } ?> \ No newline at end of file diff --git a/index.php b/index.php index d496c24..535ac85 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ get_nav_comics(); $post = $nav_comics['last']; @@ -15,22 +15,9 @@ query( - 'showposts=' . - (int)$comicpress->comicpress_options['blogpost_count'] . - '&cat=-' . - $comicpress->comicpress_options['comic_category_id'] . - '&paged=' . - $paged - ); - - while ($wp_query->have_posts()) { - $wp_query->the_post(); + foreach ($comicpress->get_index_blog_posts() as $post) { include_partial('index-blog-post'); } - - include_partial('index-blog-post'); ?>