Why isn't my WordPress next_posts_link not working with exclude category loop?
-
I’m trying to setup a loop in WordPress that will show all posts from one category, which is working just fine, however my problem is that my ‘next_posts_link’ and ‘previous_posts_link’ doesn’t work. They navigate between pages just fine but the results are the same as the first page all the time.
<?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(); ?>
I don’t think I’m using the right syntax, in fact according to the WP codex page, I don’t even think my next/prev links are able to work the way I want it to. How should I approach this?
I’d really appreciate any help people could give.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Why isn't my WordPress next_posts_link not working with exclude category loop?’ is closed to new replies.