[wp-hackers] Map a custom url to its content.
Rajasekharan S
rajasekharan.s at tcs.com
Wed May 19 05:21:33 UTC 2010
This was otto's suggestion:
add_action('template_redirect','your_function');
function your_function() {
if ($_SERVER['REQUEST_URI'] == 'whatever-you-want-the-uri-to-be') {
// produce your output
exit();
}
}
This is almost what I want it to be. A detail that I forgot to mention in
the first post was that the mapped URL should use the template that is
currently active. The content that the plugin generates should go in the
content area.
Any ideas how I can map the URL to a function and have it use the
currently active template?
Thank you all for your responses.
Raj
From:
Otto <otto at ottodestruct.com>
To:
wp-hackers at lists.automattic.com
Date:
05/18/2010 10:43 PM
Subject:
Re: [wp-hackers] Map a custom url to its content.
Sent by:
wp-hackers-bounces at lists.automattic.com
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
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
More information about the wp-hackers
mailing list