Site icon NgDeveloper

Simple Steps to create wordpress plugin

Requirements:
Wordpress (Download)
Xampp (Download)

Note:
Ensure you have local wordpress setup, if not please setup your local wordpress.

Step 1: Create a mywpplugin.php and paste the below code,

[php]
<?php

/*
Plugin Name: Naveendra
Plugin URI: http://www.naveendra.com
Description: My First wordpress Plugin
Author: Naveen kumar
Version: 1.0
Author URI: http://www.ngdeveloper.com
*/

function my_wp_plugin(){
$html = ‘My wordpress Plugin’;
return $html;
}

if(!is_admin())
add_shortcode(‘jd’,’my_wp_plugin’);

?>
[/php]

Step 2: Paste the mywpplugin.php file in
\xampp\htdocs\Naveendra\wordpress\wp-content\plugins

Step 3: After pasting the file in the above location go to admin page,

http://localhost/Naveendra/wordpress/wp-login.php and login with credentials which you created during wordpress setup time.

Dashboard -> Plugins -> Installed plugins, there you can find our plugin as well,

Now go to Posts -> Add New and paste,

[plain gutter=”false”]
The text inside my plugin is,

[jd]
[/plain]

Now publish and visit the page, you will be able to see the text which we have given in our plugin page (mywpplugin.php),

Recommended PHP and WordPress Books:

Exit mobile version