[wp-hackers] Full-page Plugins

Rob Miller r at robm.me.uk
Tue Aug 1 23:46:06 GMT 2006


Mike Purvis wrote:
> Hi everyone,
>
> I'm a bit confused about the best way to have a plugin seize control
> of the entire page. I don't want any Loop or posts or anything, I just
> need my plugin to hijack certain requests and then inject arbitrary
> content between the theme's header and footer.
>
> Hijacking requests is no problem, given the init hook, but I'm less
> sure about how to proceed with the rest. Will I need to create my own
> "page template" that contains a callback to the plugin's content
> function? If so, is there a straightforward way to package such a
> thing?
>
> Thanks,
>
> Mike
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
I normally hook into `template_redirect`, then check the conditions of 
the request to see if I want to load my template, then load_template() 
my own full-page template, then `die` to prevent the loading of the 
regular template. Whew.

-- 
Rob Miller
http://robm.me.uk/ | http://kantian.co.uk/



More information about the wp-hackers mailing list