« Return to Thread: checking if post has shortcode, before header is output?

Re: checking if post has shortcode, before header is output?

by Otto-19 :: Rate this Message:

| View in Thread

On Mon, Oct 26, 2009 at 12:41 PM, Aaron D. Campbell <aaron@...> wrote:
> That still doesn't fix the case where more than one query is ran on a page,
> when someone does something like "$myQuery = new WP_Query($params);" you'd
> process the main query, but you wouldn't get any of the shortcodes in the
> custom query.

That's because that is not possible. You're basically wanting to know
the content returned by the query before you ever run the query
itself. Can't be done, because of, you know, time only traveling in
one direction. Damn physicists.

To do this sort of thing, you'd need to use output buffering. Buffer
the whole page, then modify it after the fact, inserting what you want
where you want.

-Otto
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

 « Return to Thread: checking if post has shortcode, before header is output?