• Resolved Spencer Hill

    (@ws5f3dj7)


    So I wrote a contact form in PHP, contact-form.php. I need to include this on a page but I’m not sure of the *proper* way of doing so. Can someone help? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Add this right at the top of contact-form.php:

    <?php
    /*
    Template Name: My Contact Form
    */
    ?>

    Read more about this technique here. Then go create a page and under Template inside the Attributes box select My Contact Form. This way the page shows your form. Maybe you want to add calls to get_header and get_footer to the template as well.

    Anyway, I would recommend using Contact Form 7. Install it, configure a form under “Tools – Contact Form 7” and put the shortcode – e.g. [contact-form 1 "Contact"] – into the content of a page. It’s pretty easy.

    Thread Starter Spencer Hill

    (@ws5f3dj7)

    That’s a cool solution. Thanks!

    I would like to use something like Contact Form 7 in the future though. I was using one, but it became a pain in the butt to work with when it came to styling so just writing a basic on of my own made better sense. But I’ve struggled to write my own module thus far so this sort of hack was my best immediate solution. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do you include a custom PHP contact form?’ is closed to new replies.