Create Simple Custom WordPress Plugin

Hey developers!

I am going to show; how you can create custom wordpress plugin.

Steps to follow to create custom plugin.

Step 1: Install fresh WordPress or if you are going to create a custom plugin on existing site then its not a problem.

Step 2: Now go to Plugins folder.

Step 3: Create a New folder. And name it with your desired plugin name. Here I kept “first-custom-plugin”

Step 4: Create php file inside folder; I am keeping the name first-custom-plugin.php

Step 5: Place below code in plugin file

<?php
/**
 * Plugin Name: First Custom Plugin
 * Plugin URI: http://www.yourwebsite.com/first-custom-plugin
 * Description: First Custom Plugin created by Me.
 * Version: 1.0
 * Author: Your Name
 * Author URI: http://www.yourwebsite.com
 */
 ?>

Where all the information you need to change with your own say Plugin Name, Plugin URL, Description etc……

Step 6: You can see that plugin now in wordpress backend.

Step 7: Let’s see how it works in site actually; I am going to print simple text; try below code in your plugin file.

add_action( 'the_content', 'my_custom_plugin_text' );

function my_custom_plugin_text ( $content ) {
    return $content .= '<p style="color:#E75480">Congratulations! For your first ever plugin.....This is the text from your custom created plugin.</p>';
}

And you will see IT on site.

Thank you for showing your interest. Stay Updated. 🙂

Blog Catagory : Blog