[wp-hackers] Map a custom url to its content.
Otto
otto at ottodestruct.com
Tue May 18 17:12:49 UTC 2010
On Tue, May 18, 2010 at 6:58 AM, Rajasekharan S <rajasekharan.s at tcs.com> wrote:
> Hi all,
>
> Here's what I want my plugin to do:
>
> I want my plugin to map a URL on the blog to some content that it will
> generate like a form. The plugin generates the URL. For example:
>
> http://www.myblog.com/my-app-reserves-this-url-automatically/
>
> Visitng the URL generates shows a form. This web page is not a "page" of
> any content type that was created using the wordpress admin panel.
> Generating this page should not require the user to create a page or post
> manually using the admin panel.
>
> So my question is :
>
> How can I map a URL to a function that will return some content that the
> user will see at that URL?
add_action('template_redirect','your_function');
function your_function() {
if ($_SERVER['REQUEST_URI'] == 'whatever-you-want-the-uri-to-be') {
// produce your output
exit();
}
}
-Otto
More information about the wp-hackers
mailing list