I am developing a plugin and need to generate a blank page (load the page.php from the current theme) and print custom content such as an HTML form or a message.

It should have a URL like http://example.com/?wpex_page=confirm

How can I display a page with the current theme's page.php and custom content in it?

EDIT (18 Jan 2012):

Found a better and simpler working solution: Generate a custom/fake/virtual Wordpress page on the fly

  • 1
    I find it a bit hard to undesttand your question, why would a PAGE.PHP clutter the wp_posts?? and second , what do you mean by make the plugin dependable on the WP installation ??
    – krembo99
    Jan 5 '12 at 6:36
  • Sorry, I've removed all that. Question should be clearer now. Jan 5 '12 at 10:26
  • 1
    still not sure what you mean by "current theme " but you can always filter the content , or look at the page_template filter .
    – krembo99
    Jan 5 '12 at 11:30

Adding and catching the query vars (wpex_page=confirm) is the simple part as explained in this answer but sine you want to use the theme's default page.php there is something extra you need to do and this is a nice tutorial which covers it.

  • Thanks Bainternet! A 'virtual' page is what I was looking for :) Jan 5 '12 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.