[wp-hackers] Posts Before, Posts After

scribu scribu at gmail.com
Fri Aug 21 15:11:00 UTC 2009


On Fri, Aug 21, 2009 at 3:18 PM, Thomas Belknap
<dragonfly at dragonflyeye.net>wrote:

> Thank you, scribu! This is a good example of the way I need to do this.
>
> Is it not just a little bit strange that you can't just ask WP to grab the
> next five and the previous five? It would be nice if they adapted
> query_posts to handle this type of query, since it seems like such a
> natural
> thing to do...


There is a function for that in wp-includes/link-template.php

get_adjacent_post()

You just have to hack it to change the LIMIT from 1 to 5.

The only problem is that it's not context aware, except for $in_same_cat.


-- 
http://scribu.net


More information about the wp-hackers mailing list