WordPress query_posts show the same page

Sometimes I forget to amend any special queries I’ve setup within WordPress templates so that when I click on the “older posts” button I simply get the same page displayed again.

For special queries you should add the paging code below.

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('category_name=staff&posts_per_page=10&paged=' . $paged); ?>
Dave Walker
Dave Walker is a middle aged programmer living in North Yorkshire, who loves music and used to enjoy constantly restarting fitness regimes with a bit of football, cycling, swimming & jogging. Now I just eat biscuits.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.