• I am attempting to build my first plugin.

    I have a form that collects the infon necessary to create a post. Before I allow the post to go into the Database I need to force the user to accept my TOS.

    I have a checkbox and a link. The link will go to the TOS page (my custom PHP page) and once the user accepts the TOS the user can come back to the FORM which is populated with their data and the checkbox is checked.

    The user can also just check the box and submit their post.

    My question is how do I wrap my TOS page so that it matches the existing website. I want my PHP page to be wrapped to use whatever theme the user has selected for their website. In addition I want to come back to the form with it wrapped in the users theme just like it was originally.

    I open my form using a hook so all is good up to there.

    I want to understand how to do this the right way not the cheap and easy way.

    Thanks in advance for any assistance you can offer.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t think there is a “right” way. If you use good judgment on how to accomplish something without concern for how hard it might be to code, you’re probably on the “right” track.

    It’s difficult for a plugin to interface well with any given theme, not knowing what it might be. All you can do is come up with something that should work with most themes and have robust error handling so the process fails gracefully if your assumptions about the theme do not apply for a particular installation.

    Here’s what I would try, FWIW. I would add a “page” post type to the DB with the TOS as content and a clever title unlikely to already exist. Specify in postmeta ‘_wp_page_template’ set to “default”. That should yield a properly styled page in most themes. Where my knowledge fails is how to detect when this does not work. It’s a start at least, hope it helps.

Viewing 1 replies (of 1 total)
  • The topic ‘How do I add linked custom PHP page to plugin’ is closed to new replies.