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 Pakainfo.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 exampleExample

In this post we will show you Best way to implement how to create plugin in wordpress tutorial, hear for wordpress plugin development tutorial step by stepwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

What is a WordPress Plugin?

WordPress Plugin: A WordPress simple Plugin is a one type of PHP program, or a set ALL of one or more PHP functions, written in the OOP Based PHP scripting language, that adds a rules and custom this specific set of ALL the Custom features or services to the WordPress website or weblog, which can be seamlessly simple integrated with the simple weblog using access points level and methods or function and connection to database provided by the simple WordPress Plugin web-Application Program ui Interface (API).

Read Also:  Autocomplete Textbox with Multiple Values using jQuery PHP and MySQL

Creating a simple Plugin

Plugin Name
Plugin Files
Readme File
Home Page
Standard Plugin File

<?php
/**
* Plugin Name: your Plugin Name
* Plugin URI: https://www.pakainfo.com/
* Description: A brief some description about simple your plugin.
* Version: 1.0 or or more whatever version of the supported PHP plugin (pretty self explanatory)
* Author: Plugin simple nik name Author's Name
* Author URI: Author's simple website Like as a (live24u.cin)
* License: A company "Slug" license webs name e.g. DSP214
*/

The minimum WordPress needs to establish your file as a plugin is the line
Plugin Name: My Plugin Name

Working with action hooks

<php add_action('wp_footer', 'mp_footer'); ?>

Creating the plugin’s administration page

Database settings
database host
database name
database user
database password
Store settings
store URL
folder for the product images

Read Also:  How to Create a Wordpress Plugin in 10 Minutes Flat

function oscimp_admin_actions() {
 
}
 
add_action('admin_menu', 'oscimp_admin_actions');

<?php
/*
 * Plugin Name: cars Api
 * Version: 1.0.0
 * Description:  It will diaply all cars list. enjoy :)
 * Author: Live24u com
 * Author URI: https://www.pakainfo.com/services/web-development/
 * Plugin URI: http://www.Pakainfo.com
 * Text Domain: cars-api
 * Domain Path: /languages
 * License: http://www.Pakainfo.com
 * License URI: http://www.Pakainfo.com
*/

add_action('cars-api', 'get_cars_api');
add_shortcode('cars-api', 'get_cars_api');
function get_cars_api( $atts, $content = null ) 
{	
	ob_start();
	
	$url="https://kingproxies.com/api/v2/proxies.json?key=58975689545725586456565656898953568";

$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);

// Will dump a beauty json :3
$obj = json_decode($result, TRUE);

echo '<div class="container"><table id="carslist" class="table table-striped table-bordered" cellspacing="0" width="100%"><thead><tr><td>IP</td><td>PORT</td><td>REGION</td><td>CITY</td><td>COUNTRY_CODE</td><td>PROTOCOLS</td>	<td>RELIABILITY</td></tr></thead><tbody>';

$data = $obj['data']['proxies'];
for($i=0; $i<count($obj['data']['proxies']); $i++) 
{
	$protocols = implode(", ",$data[$i]['protocols']);

		echo '<tr>';
		echo '<td>'.$data[$i]['ip'] .'</td>';
		echo '<td>'.$data[$i]['port'] .'</td>';
		echo '<td>'.$data[$i]['region'] .'</td>';
		echo '<td>'.$data[$i]['city'] .'</td>';
		echo '<td>'.$data[$i]['country_code'] .'</td>';
		echo '<td>'.$protocols .'</td>';
		echo '<td>'.$data[$i]['reliability'] .'</td>';
		echo '</td>';
		echo '</tr>';
		
}
	
echo '</tbody></table>';	
	
	?>
<link rel="stylesheet" href="/wp-content/plugins/cars-api/css/bootstrap.min.css">
<link rel="stylesheet" href="/wp-content/plugins/cars-api/css/dataTables.bootstrap.min.css">

<script src="/wp-content/plugins/cars-api/js/jquery-1.12.4.js"></script>
<script src="/wp-content/plugins/cars-api/js/jquery.dataTables.min.js"></script>
<script src="/wp-content/plugins/cars-api/js/dataTables.bootstrap.min.js"></script>	
<script>
   $('#carslist').DataTable({
		
		"pageLength": 50,
		"order": [[ 2, "desc" ]]
	});
</script>
	<?php
	
	return ob_get_clean();
}

function wpautop_control_options() {
	echo "cars Api<br>"; 
	echo "How to use this plugin in post/page?<br>";
	echo "For Disply cars Api, Add Shortcodes in your post/page : [cars-api]";
	
}

add_action('admin_menu', 'wpautop_control_menu');

function wpautop_control_menu() {
  add_submenu_page('options-general.php', 'wpautop-control', 'cars Api Shortcode', 'manage_options', 'cars-api-menu', 'wpautop_control_options');
}

?>

Example

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