Support » Fixing WordPress » Next and Previous posts link within wp_query loop

  • I’ve written a custom page template to hand a specific category of posts. I have a page for press releases that queries the db and displays all of the posts in category=10 in a specific way. I just added my 11th press release to that category today, and it pushed the oldest press release off my page. That is, the page only displays the 10 most recent releases, so when I added the 11th, one no longer displays. I grabbed this code from the archive.php page:

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

    but it doesn’t work on the page, and, judging from the codex entry on those commands, it’s because it’s no inside a typical WordPress loop. It’s more of a mini-loop, if I am not mistaken. Is there a different function used to paginate the search results of this page?

    The loop I have looks like this:

    	$profiles = new WP_Query();
    		  $profiles->query("cat=10"); ?>
    <?php while ($profiles->have_posts()) : $profiles->the_post(); ?>
    		[...] Display/format each post.
        <?php endwhile; ?>
Viewing 1 replies (of 1 total)
  • Arg. I have exactly the same problem. Minus categories.

    Essentially I’m making an alternate version of the typical index page.

    Did you figure it out?

Viewing 1 replies (of 1 total)
  • The topic ‘Next and Previous posts link within wp_query loop’ is closed to new replies.