how to create custom plugin in wordpress from scratch

how to create custom plugin in wordpress from scratch

In this Post We Will Explain About is how to create custom plugin in wordpress from scratch With Example and Demo.Welcome on Live24u.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to how to create plugin in wordpress with example Example

In this post we will show you Best way to implement wordpress plugin tutorial for beginners, hear for create wordpress plugin from scratchwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :   Wordpress Advanced Search query custom fields




wordpress plugin development tutorial step by step

We learn to Custom plugin is used to all the core php customize the wordpress simple default implemantation both admin side and frontend side.

simple setp by setp WordPress provides more standard which some need to follow to make custom plugins.

There are the following list of the crate custom plugin in wordpress.

Step : 1 plugin header

Step 1. make a directory(folder) for custom new plugin under some plugins (folder)directory. make a php new file under the new (folder)directory and add the following script source code in it.

Also Read :   woocommerce - create an ecommerce website with wordpress step by step

At first of all you need to simple custom define plugin header set as follows.

<?php
/*
 
Plugin Name:Create WordPress Custom Plugin
 
Description:This is a Live24u.com custom plugin for learning step by step.
 
Author:Gondaliya Jaydeep
 
Version:1.0
 
*/
 
?>

And then defining some header the first path plugin will be listed in simple admin panel under some plugins menu. we can here click to activate/deactivate/delete your plugin the plugin from here.

Step : 2 plugin activate/deactivate/delete

Step 2. Create some tables on table new or activation

register_activation_hook( __FILE__, array( 'CustomPlugin', 'install' ) );
global $wpdb;
$students = $wpdb->prefix . "Employee";
if($wpdb->get_var("show tables like '$students'") != $students) {
$sql = "CREATE TABLE " . $students . " (
id int NOT NULL,
lname varchar(255) NOT NULL,
fname varchar(255),
Address varchar(255),
salary_range int
PRIMARY KEY(id)
);
//Basic path include
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}

Step : 3 create shortcode

Step 3.Define simple shortcode for plugin for frontend.


add_shortcode('custom_plugin_name','function_to_call');
//simple exmaple below
add_shorcode('booking_engine','booking_template');

//call a custom function 
function booking_template(){
 
include_once "booking-form.php";
 
}





Example

Also Read :   how to create custom plugin in wordpress from scratch

I hope you have Got What is wordpress plugin tutorial for beginners And how it works.I would Like to have FeadBack From My Blog(live24u.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(live24u.com) Are Most Always Welcome.