move index blog posts out of index.php
This commit is contained in:
parent
bc53907ac3
commit
2924eaf1ad
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
17
index.php
17
index.php
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue