以下是我 home.php 中的代码,它可以工作但不能分页,我做错了什么,或者有更好的方法来编写代码以使其工作?请帮忙。
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
echo "<div id=\"featured_post\">";
query_posts( array ('post_type'=>'post', 'paged' => $paged, 'category_name' => $featured_cat_name, 'posts_per_page' => 4, 'ignore_sticky_posts'=>1 ) );
$fcount = 1;
if (!$paged):
while ( have_posts() && $fcount < 5 ) : the_post();?>
<div id="post-<?php the_ID(); ?>" class="view"><?php
$format = get_post_format();
if ( false == $format ):
featured_posts_first();
else :
featured_posts_test();
endif;
echo "</div>";
$fcount++;
endwhile;
else :
while ( have_posts() ) : the_post();?>
<div id="post-<?php the_ID(); ?>" class="<?php if (get_post_format() == audio): echo 'audio-isa view'; else : echo 'view'; endif; ?>"><?php
featured_posts_test();
echo "</div>";
endwhile;
endif;
echo "</div>";
//get posts navigation
global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) {
thematic_navigation_below();
}
wp_reset_query();