[wp-hackers] Full-page Plugins

Mike Purvis mike at uwmike.com
Sat Aug 5 13:15:12 GMT 2006


Thanks, Robert. The template_redirect + load_template() bit was perfect.

What I'm actually doing, which is kind of cool, is letting outside
scripts call wp-blog-header.php, but first set a global variable
called $content. When the plugin detects this variable, it shows that
content rather than whatever the default would have been.

One of the things we use it for is source-code displays, such as the following:

http://googlemapsbook.com/chapter6/dataFiltering/map_functions.js.source#listing-6-20

Obviously, there are some htaccess redirect rules at work here, as
well, but you get the external dynamic content, and it's all inside a
standard WP theme. Hope that's helpful to someone.

Mike


On 8/1/06, Rob Miller <r at robm.me.uk> wrote:
> 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/
>
> _______________________________________________
> 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