我想在Wordpress中设置一个循环,它将显示来自一个类别的所有帖子,这是工作得很好,但我的问题是,我的'next_posts_link'和'previous_posts_link'不起作用。他们在页面之间导航就好,但结果始终与第一页相同。为什么我的WordPress的next_posts_link不能用于排除类别循环?
<?php get_header(); ?>
<div id="main" role="main">
<?php
if (is_home()) {
query_posts("cat=-6");} //Exclude work posts (cat 6) from the news page
?>
<div class="inner">
<h1><?php trim(wp_title("")); ?></h1>
<?php include ('sidebartwo.php'); ?>
<section class="main-wrap twocol news">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article class="box-style">
<time><?php the_time('M d') ?><span><?php the_time('Y') ?></span></time>
<h2><a href="<?php the_permalink()?>" title="<?php the_title(); ?>"><?php the_title(); ?>
</a></h2>
<?php the_content(''); ?>
</article>
<?php endwhile; ?>
<div class="next-prev-wrap">
<!-- This is what isn't working properly -->
<span class="next"><?php next_posts_link('Older posts', $post->max_num_pages); ?></span>
<span class="prev"><?php previous_posts_link('Newer posts', $post->max_num_pages); ?>
<!-- /end -->
</span>
</div>
</section>
<?php endif; ?>
</div> <!-- /inner -->
</div> <!-- /main -->
<?php get_footer(); ?>
我不认为我使用的是正确的语法,其实根据WP抄本页面,我甚至不认为我的下/上一个环节都能够工作,我希望它的方式。我应该如何处理这个问题?
如果你已经找到了答案,你自己的问题,您必须使用“您的答案”部分并将其标记为已接受,而不是编辑问题。 – 2012-02-01 11:28:22