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

ayj & j yllyn at clear.net.nz
Wed Jun 16 06:16:27 UTC 2004


I hope this is not too generalised a question. One of the things I have
found most difficult to find my way into is intervening in the derivation of
$posts within wp-blog-header.

For *example* (I am not specifically looking for a solution to this
problem).

You are running a normal wp loop and you want to

1. exclude certain (unknown number of) posts based on certain predetermined
post ID's BUT

2. Still output the correct number of posts to the page.

Looking at wp-blog-header the number of posts is controlled by $limits which
shows up in many of the different possible situations covered. Could there
be any efficient way of influencing this other than hacking into every
single condition under which $limits is derived - which would leave a much
mutilated wp-blog-header (actually a better alternative would be by
excluding the specific ID's via the "$where" conditions, but again scattered
through many different points in wp-blog-header).

Another approach would be if the derivation of $posts was able to be
influenced directly from the template, like being able to say

case 1: give me $posts but exclude those with ID's in this list, - the
exclusion to occur as part of the $posts derivation rather than after the
event leaving the wrong number of posts on the page.

or case 2, give me $posts but add X=2 to the number of posts for the page
this time

Maybe this can already be done - I haven't found it yet. Like I said at the
start the real question is general - how to intervene in the derivation of
$posts in wp-blog-header

Andrew




More information about the hackers mailing list