views:

134

answers:

1

Starting out with Wordpress plugin development - how does a plugin add a page to Wordpress that utilizes the current theme? For instance the plugin would create a page at this URL:

http://wordpress/plugin-name/start

This page should display a form using that utilizes the current theme. At the end of the day I'm going to replace the current front-facing Wordpress login and registration mechanisms with a custom implementation.

+1  A: 

You want to hook a function to the template_redirect action. There you can recognize the special URL(s) you want and then you can load your own template accordingly.

To make it use the existing theme, you can do similar things like a theme would, such as call get_header(), get_footer(), get_sidebar(), etc.

After you've output your page, you'll need to explicitly call exit(); to prevent the normal page output from occurring.

Note: In WordPress 3.0, a better way is to hook to the template_include filter, and have it return the file-include-path to your own template file. This doesn't require the exit();, so it's more compatible with other plugins.

Otto