Home / Wordpress / WordPress Form Plugin with ShortCode

WordPress Form Plugin with ShortCode

Hi all,
I am going to explain you how easily you can create your own shortcode using one simple examples.
Shortcode function to create shortcode in WordPress plugin. For using shortcode function, you have to define a handler function that parse the shortcode and return some output.
Then, you need to register a shortcode using add_shortcode() function.




add_shortcode( $shortcode_name, $handler_function); You can create shortcode to display form on any page or post of the website.

<?php
/*
* Plugin Name: WordPress plugin-shotrcode
* Description: Create your WordPress shortcode.
* Version: 1.0
* Author: Pritty
* Author URI: http://prittytimes.com
*/
function form_creation()
{
?>
<form>
First name: <input type=”text” name=”firstname”>
Code Details:
form_creation()- to create a form which includes form fields.
add_shortcode()- function which contain shortcode name test and calling of form_creation() function as parameters.




You need to place WordPress shortcode within square brackets in order to represent it on any page or post of the website.Code word test enclosed within square brackets like [test].

Loading Facebook Comments ...
Social Media Auto Publish Powered By : XYZScripts.com