≡ Menu

Writing a WordPress Plugin (My First WordPress Plugin)

I’ve never actually taken the time to write my own pluging for wordpress. I have thought about it a few times, but I’ve never had the need to.

See wordpress uses one of my favorite rewrite rules that checks to see if a file exists, and if it does, it acknowledges the fact it does, and doesn’t try to take over. So in the past, when I needed something customized, I would simply create a php file of my own, and bypass wordpress all together. It the down and dirty solution to adding pages to a site without needing to integrate it with wordpress. So the need for writing a plugin has never really been there.

Well today, I decided that some code I was writing deserved to be made into a plugin. I’m presently coding up the module for my wedding website that will allow people to RSVP. There is probably already a module out there for doing this kind of thing, but I didn’t find one in the 5 minutes I looked for one that could do everything I wanted…

That said, it’s time to get started. I’m hoping to document the process here in a series of blog posts (if I don’t get to lazy). The code will most likely be finished within an hour or two of this blog post, but my lessons probably won’t be online for awhile longer (I’ll delay each post as I write it to provide daily content for the blog… After all, no one wants to read this stuff all at once right?)

So let’s begin… Hello world time!

Getting Started

It’s really easy to get WordPress to recognize that you have a plugin you want it to play with. You simpy have to put a file with some of the “right” information, into the right folder… So let’s do it. Here it is laid down in step by step instructions.

  1. Create a php file. Name it something resonable and make sure it ends with .php.
  2. At the start of that file, insert the following lines of code, modifying it with your details (obviously):

    < ?php /* Plugin Name: OurVows RSVP Plugin URI: http://www.ourvows.net Description: A Private Plugin for RSVPing on our wedding website Version: .50 Author: Justin Gehring Author URI: http://www.rinsefirst.com/ */

  3. Save and upload the php file to your “wp-content/plugins/” folder
  4. Open up web browser and load up your wordpress admin panel.
  5. Goto the “Plugins” section of the WordPress admin panel. There you should see a line for your newly created plugin that looks like this:

Congratulations! You just created your first WordPress plugin. It does ABSOLUTELY NOTHING! But hey, at least its in the list of plugin’s right. Next post, we’ll talk about how you actually go about getting it to display information to the page.

Comments on this entry are closed.

  • David April 13, 2009, 3:54 pm

    Did you ever finish this? I'd love to check it out, and possibly use it…