Wordpress - 分页不起作用?

时间:2013-01-14 16:00:23

标签: wordpress pagination

以下是我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();

1 个答案:

答案 0 :(得分:1)

我建议您使用simple pagination这样的分页插件 - 非常易于使用。

或者使用this

相关问题