// contact_page_template.php
<?php 
/* 
 * Template Name: Contact Form 
 * Template Post Type: page 
 */ 
 
get_header(); 
?> 
 
<div> 
    .. content before contact form 
</div> 
<!-- Form section -->
<div id="contact-form"> 
    <form action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="post" name="custom_contact_form"> 
        <div> 
            <label for="fullname"> 
                Full Name: 
            </label> 
            <input type="text" name="fullname" id="fullname" required /> 
        </div> 
        <div> 
            <label for="email"> 
                Email: 
            </label> 
            <input type="email" name="email" id="email" required /> 
        </div> 
        <div> 
            <label for="message"> 
                Message: 
            </label> 
            <textarea name="message" id="message" required></textarea> 
        </div> 
 
        <!-- pass admin method to handle form post -->
        <input type="hidden" name="action" value="custom_contact_form"> 
 
        <button type="submit" name="send_message"> 
            Send 
        </button> 
 
    </form> 
</div> 
<!-- End of Form section -->
<div> 
    .. content after contact form 
</div> 
 
<?php get_footer(); ?>