This entry is part 1 of 7 in the Writing Your First WordPress Plugins, Basic to Advanced Series
- How to Begin Writing Your First WordPress plugin
- Structuring Your First WordPress Plugin
- Writing Your First WordPress Plugin Part 3
- Writing Your First WordPress Plugin Part 4
- Writing Your First WordPress Plugin Part 5
- Writing Your First WordPress Plugin Part 6
- Writing Your First WordPress Plugin Part 7 – Final
The world of plugins can seem a scary place to venture if you’ve never been there before. I remember when I first started, it was because I wrote a tutorial over at Pro Blog Design about how to create a custom Font Uploader for your WordPress theme, and readers asked that I make it into a plugin. My first thoughts were “no way, I have no idea how and I’m comfortable with themes.” After a little bit of groaning, I decided to jump in and figure it out. A year and a half later I’m here, telling all of you how to write a plugin. Believe me, it’s not nearly as scary as I thought it was.
The video below describes the process of creating your first plugin. If you want, skip straight to the code with minimal explanation, but get started in seconds. Your first plugin can be ready to go in less than a minute.
This code should be placed at the top of a .php file that is named after your plugin. In this case, I have named my file “my-first-plugin.php”.
1 2 3 4 5 6 7 8 9 | <?php /* Plugin Name: My First plugin Plugin URI: https://pippinsplugins.com/how-to-begin-writing-your-first-wordpress-plugin Description: This is my first WordPress Plugin Author: Pippin Williamson Author URI: https://pippinsplugins.com Version: 1.0 */ |
Once you’ve dropped this code into the plugin file, go to your WordPress plugins page, find the plugin and click Activate.
If you want proof that your plugin is, in fact working, then add the test function I demoed in the video. Please note, this function is not something you should ever use in an actual plugin. It is merely something that thoroughly demonstrates that your plugin is active and working.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php /* Plugin Name: My First plugin Plugin URI: https://pippinsplugins.com/how-to-begin-writing-your-first-wordpress-plugin Description: This is my first WordPress Plugin Author: Pippin Williamson Author URI: https://pippinsplugins.com Version: 1.0 */ function my_plugin_test() { echo 'Hello World'; exit; } add_action('admin_head', 'my_plugin_test'); |
Awesome intro to plugin dev. I have a few plugins in mind that I’ve been meaning to make and this series should be just what I need to get going. Thanks for the time and effort in putting it together.
This was a great into into the plugin development arena. Hoping to learn a few things over the next few weeks.
Excellent getting started post as it takes the intimidation out of writing a WordPress plugin.
Just signed up for the website and cannot wait to go through the tutorials. Thank you Pippins for creating this for the community.
Glad to help, and thank you for signing up!
awesome watched all parts now… just what I looked for.
thanks a lot!
Thank you for the video knowledge. this is awesome!
Very nice intro…
I’m new in all this wp stuff, but you have a nice voice and talent to tell the things…
Thank you… watching all the videos right now!
that was great start bro purely learning tutorials
Good Intro.
I’ve been working as a programmer since 5 years now but always ignored wordpress.
But now coming to WP world to serve more customers.
Thanks for sharing your knowledge.
Looking forward to learn more.
Hmmm…was hoping for more! So many your-first-plugin videos just talk about how the header info makes for a plugin — would be better if some idea of WP hooks and filters (or whatever they’re called; I’m a pre-beginner!) was given.
I’m not asking for PHP tutorials but some idea of a sense of what to do beyond the header would be really useful! 🙂
Take a look at my two plugin development series. They both go through many different aspects of plugin development.
Thank you for sharing your expertise with your readers.
Escelente tutorial.
Helped me a lot, I’m now starting my first plugin.
Hug! Success! Acts Joshua Mota
I really appreciate your great 7 plugin tutorials. I’ve looked around and googled a long long time. Your’s simply the best.
Thank you so much.
I can’t view the video.
I had inspect element and saw this embedded link
http://www.screenr.com/embed/fXKs
Looks like Screenr.net’s video embed has broken. I’ve updated it with a direct link.
hi
i am working to develop a plugin please help me i want to store multiple check box value in wp option table
foreach( $result as $results ) {?>
<input id="avk_setting[mls_id; ?>]” type=”checkbox” name=”avk_setting[mls_id; ?>]” value=”1″mls_id]); ?>/>
<input type="hidden" id="avk_setting['mls_id']" name="avk_setting['mls_id']" value="mls_id]); ?>” />
Which part of that are you having trouble with?
Hi i’m new to wordpress so when i started creating a first plugin then after saving with php extension it not showing in wordpress site can you help me .