开发者

query_posts Exclude Directory, next_posts_link not work

开发者 https://www.devze.com 2023-02-27 09:48 出处:网络
Can anybody look at the following codes? After I excluded the category 15, the next_posts_link does not work, nor does the page navigation plugin. When I click the page 2, 3,4, it only display the pos

Can anybody look at the following codes? After I excluded the category 15, the next_posts_link does not work, nor does the page navigation plugin. When I click the page 2, 3,4, it only display the posts in page 1.

<?php query_posts('cat=-15'); ?>

   开发者_JS百科 <?php while (have_posts()) : the_post(); ?>
           ...  ....
         <?php endwhile; else: ?>
        <?php next_posts_link() ?>
    <?php endif; ?>


How about...

<?php query_posts('cat=-15'); ?>

    <?php while (have_posts()) : the_post(); ?>
           ...  ....
    <?php endwhile; ?>

  <?php next_posts_link() ?>        

<?php endif; ?>

??


Try it like this:

<?php query_posts(array( 'cat' => -15, 'paged' => get_query_var('paged') ) ); ?>

This should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消