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

Alex Andrews awgandrews at gmail.com
Sun Jan 24 16:07:06 UTC 2010


Thanks you two for your responses already. Problem is that a) I do  
need to use the plugin redirect hook for this plugin b) even I did it  
in the way the first respondent suggests this still wouldn't help as  
the template tags still have no idea what page we are on. Is there not  
a set of variables in wp_query that tell the tags that it is a page  
etc that can be set by the plugin? I've tried a few but it is  
difficult to guess which ones are required.

Thanks again.

Alex

On 24 Jan 2010, at 09:38, Peter Westwood <peter.westwood at ftwr.co.uk>  
wrote:

>
> 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
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list