WordPress.org

Ready to get started?Download WordPress

Forums

Next and Previous posts link within wp_query loop (2 posts)

  1. RyanJenkins
    Member
    Posted 5 years ago #

    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>
    	</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:

    <?php
    	$profiles = new WP_Query();
    		  $profiles->query("cat=10"); ?>
    
    <?php while ($profiles->have_posts()) : $profiles->the_post(); ?>
    
    		[...] Display/format each post.
    
        <?php endwhile; ?>
  2. bcatdc
    Member
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic