[wp-hackers] Fooling Wordpress To Think Plugin Output Is A Page

Peter Westwood peter.westwood at ftwr.co.uk
Sun Jan 24 09:38:15 UTC 2010


On 24 Jan 2010, at 00:42, Alex Andrews wrote:

> Dear list,
>
> In my plugin I interrupt template_redirect to produce my own pages via
> loading my own templates. However, to trick certain bits of the
> template into working, it would be very useful for Wordpress to think
> these are pages proper, with titles etc. Is there some internal
> Wordpress variable or set of variables I can set to do this? It would
> be especially good if I could trick the plugin generated page to think
> it was a part of the normal hierarchy of Wordpress pages, ie could
> possibly have parents etc, while not being an part of this formally.

The best way to do this is to create the page but modify its output.

Either use a page template or other plugin code to modify the output.

I would suggest you look at Mark Jaquiths new "I make plugins" plugin  
as an example of how to do this.

http://plugins.svn.wordpress.org/i-make-plugins/trunk/i-make-plugins.php

Cheers

Peter
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list