bill.erickson at gmail.com
Wed Dec 21 15:10:39 UTC 2011
I like to use the pre_get_posts hook for any modifications to the main
Here's a quick article with examples:
On Wed, Dec 21, 2011 at 5:34 AM, Mike Little <wordpress at zed1.com> wrote:
> On 20 December 2011 18:53, IC IC <icwordpress at gmail.com> wrote:
> > When you run the query_posts( 'posts_per_page=5' ); does it really
> > throw away the original query and re-run the same query - just to
> > compile the same recordset but this time with only 5 recs?
> > Would it be better exiting out THE LOOP at the 5th record?
> > Am I missing something here?
> It is better to modify the query before it is run, rather than run a new
> query, which is what your code above does.
> You can modify the query before it is run by hooking into one of the many
> hooks available.
> Here is an example of modifying the number of posts displayed
> There are other methods too.
> Mike Little
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers