Here We Will Learn About How
To Create Custom Form In Wordpress.
For Create Custom Form First
We Have To Create Template For That. So Below Is A Code For Create Template For
Form.
Create A Php Page Name
As page-custom-form.php And Add Below Code In That Page.
<?php
/*
Template Name: Custom Form
*/
get_header();
?>
<div class="wrap">
<div
id="primary" class="content-area">
<main
id="main" class="site-main" role="main">
<form method="post"
enctype="multipart/form-data" onsubmit="return
form_validation();">
<div
class="form-group">
<label>Title</label>
<input
type="text" name="form_title" id="form_title">
</div>
<div
class="form-group">
<label>Description</label>
<input
type="text" name="form_description" id=" form_description
">
</div>
<div
class="form-group">
<label>Image</label>
<input
type="file" name="form_image" id="form_image">
</div>
<div
class="form-group">
<label>Type</label>
<select
name="form_type" id="form_type">
<option
value="">- Select Type -</option>
<option
value="low">Low</option>
<option value="medium">Medium</option>
<option value="hard">Hard</option>
</select>
</div>
<div
class="form-group">
<label>Form
Author</label>
<input
type="text" name="form_author_name" id="form_author_name">
</div>
<div
class="form-group">
<input
type="submit" value="Save">
<?php
wp_nonce_field( 'form_submit_flag', 'form_submit' ); ?>
</div>
</form>
</div>
</div>
</div>
Get all latest tech updates, coding and programming Learn latest technology, software development skills, b.tech, MCA and BCA
ReplyDeletecomputer programming training.