WordPress query_posts show the same page


07

Dec
2010

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); ?>




One Response to “WordPress query_posts show the same page”

  1. Big thanks for this short, concise, post. You wouldn’t believe how some bloggers drivel on about this topic.

    Regards,

Leave a Reply



Latest from the Blog!

Has Dave written anything of note? Probably not!

Cold International Calls

I have Caller-ID.  When phone rings in the office and I see the “International” ID I know it’s usually a cold call. Todays went like...

I hope you’re following Jesus?

Well I thought it was funny )