Post emergency WordPress questions for fast help... ...Or answer questions first & win prize money.

$20
Problem with pagination...

The Pagination for this wp site is not functioning properly for the recipe category of posts. The site is at http://lemonadecleansetogo.com/programs/recipes/ When I click on page #2 or 3, it loads the same posts as page 1 for the recipes. The template is called gravy.

Here is the code for the recipes template:

<?php
/*
Template Name: recipes
*/
get_header(); ?>

<div id="content">

<?php query_posts('category_name=recipes'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php include (TEMPLATEPATH . '/loop.php'); ?>
<?php endwhile; ?>
<?php numeric_pagination(); ?>

<?php else : ?>
<h2>
<?php _e('Not Found','gravy'); ?>
</h2>

<?php endif; ?>
</div>
<!--/content-->
<?php get_sidebar('recipes'); ?>
<?php get_footer(); ?>


Please let me know if you need any other additional information to help solve this problem ...
Thanks!

Mark Garretson | 01/25/10 at 6:57pm | RSS Answers

(2) Possible Answers Submitted...

  • avatar
    Last edited:
    01/26/10
    12:10am
    Brandon Dove says:

    change this


    <?php query_posts('category_name=recipes'); ?>


    to this

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=recipes&paged='.$paged);
    ?>

  • avatar
    Last edited:
    01/25/10
    7:12pm
    Justin Tadlock says:

    Assuming your `numeric_pagination()` function works correctly, you would only need to change one line of code.

    This line:

    <?php query_posts('category_name=recipes'); ?>


    Should be:

    <?php query_posts( array( 'category_name' => 'recipes', 'paged' => $paged, 'posts_per_page' => get_option( 'posts_per_page' ) ) ); ?>

This question has expired.