move index blog posts out of index.php

This commit is contained in:
John Bintz 2009-07-19 19:20:23 -04:00
parent bc53907ac3
commit 2924eaf1ad
2 changed files with 30 additions and 15 deletions

View File

@ -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;
}
}
?>

View File

@ -1,7 +1,7 @@
<?php
global $comicpress;
get_header();
comicpress_get_header();
$nav_comics = $comicpress->get_nav_comics();
$post = $nav_comics['last'];
@ -15,22 +15,9 @@
<?php include_partial('index-blog-header'); ?>
<?php
$wp_query = new WP_Query();
$wp_query->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');
?>
</div>