[wp-hackers] Plugin custom page

Chris Taylor - stillbreathing.co.uk mrwiblog at gmail.com
Sat Nov 17 23:27:23 UTC 2012


I'm currently updating my VoucherPress plugin which allows WP admins
to create vouchers that visitors can download. One of the optional
features of a voucher is to require the user to register their name
and email address to get a link to download the voucher. When the user
clicks a link to the voucher they should see a form asking for their
name and email address. If the voucher doesn't require their email
then they get the PDF immediately.

To support any template I need the form to be output using something
like the "the_content" filter, so it appears as if it's a real page.
The URL which is requested is something like
mysite.com/?voucher=abc123. This looked like it was going to work,
however when the front page is set to display multiple posts each post
gets its content filtered leading to multiple voucher forms on the
page. What would be the best way to handle this kind of custom page in
my plugin, seeing as just calling get_header() and get_footer() (which
is what the current version of the plugin does) may miss out large
parts of a templates design?

1) Use "the_content" and somehow break the loop?
2) Use a custom URL (e.g. "mysite.com/voucherpress/abc123") and map
that to the page/single/index page?
3) Something else?

Many thanks,


More information about the wp-hackers mailing list