🚀 My First WordPress Plugin Tutorial
Welcome! This is a simple example to help you learn how to build your first WordPress plugin. Copy the code below and try it yourself!
💡 Step 1: Create a Plugin File
In your WordPress folder, go to wp-content/plugins/ and create a new folder named my-first-plugin.
Inside that folder, create a file called my-first-plugin.php and paste the following code:
<?php
/*
Plugin Name: My First Plugin
Plugin URI: https://example.com
Description: A simple starter plugin.
Version: 1.0
Author: Your Name
License: GPL2
*/
function mfp_hello_world() {
echo "<p style='color:green; text-align:center;'>Hello, World! My first plugin works 🎉</p>";
}
add_action('wp_footer', 'mfp_hello_world');
💻 Step 2: Activate Your Plugin
Now go to your WordPress dashboard → Plugins → Activate My First Plugin. Visit your site — you’ll see “Hello, World!” appear at the bottom!
No comments:
Post a Comment