[wp-hackers] Intervening in $posts derivation in wp-blog-header

ayj & j yllyn at clear.net.nz
Thu Jun 17 06:44:36 UTC 2004


> We could add something like:
>
> $where = apply_filters('posts_where', $where);
>
> to query_posts.  Plugin writers would have to be very careful they
> didn't butcher queries, of course.
>
> For those just wanting to post-process $posts, we could do the following
> after we call query_posts() in wp-blog-header.php.
>
> $posts = apply_filters('the_posts', $posts);
>
> Ryan


The $where suggestion is exactly what I was thinking, it could be very
helpful in a wide range of circumstances. It may also be that you allow
similar interventions in other parts of the query too eg $limits, $orderby,
SELECT (more columns) FROM (more tables)?

For post processing $post I have found it is easy to work from the template
itself though a filter is tidier.

Matt, am I understanding your sticky / category suggestion right. If you
want a post to be sticky for say catA and catB you make it a member of both
of those categories plus a member of .sticky and then use that info to
determine display, order etc?

A digression but the custom field would be close to as easy as a category
field if it could be processed in the same step as "Publish". But in fact
any method that works is fine.

Andrew




More information about the hackers mailing list