静态页面上的分页

时间:2011-11-30 12:08:26

标签: wordpress pagination

我在静态页面上有这段代码

$novo = new WP_Query('cat=3');
while ($novo->have_posts()) : $novo->the_post(); ?>
    <div id="entry">
    <!-- POST FORMAT HERE -->
    </div>


<?php endwhile; ?>


    <div class="navigation">
    <span class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></span>
    <span class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></span>
    </div>

这种导航在这里不起作用。请谁帮我这个, 我将非常感激

1 个答案:

答案 0 :(得分:0)

尝试添加此代码:

$paged = get_query_var( 'page' );
    if(!$paged)
    {
        $paged = get_query_var( 'paged' );
    }
    if(!$paged)
    {
        $paged = 1;
    }
$novo = new WP_Query('cat=3&paged=' . $paged);