How to Write a WordPress Plugin - Introduction

Monday, May 7th, 2007 6:00 am by Ronald Huereca Print this Article Print this page Comments Comment Share This Share This

How To Write a WordPress Plugin Series

This post was written as part of the How to Write a WordPress Plugin series.

For any WordPress user, plugins are essential. WordPress Plugins allow those with little to no programming skills to extend the functionality of their blog. Plugins come in all shapes and sizes, and there is a plugin that does just about anything for WordPress.

As good as WordPress is as a standalone application, there are still things that WordPress lacks. Users are requesting more and more features for WordPress that would be very feasible to write as a plugin. There are many untapped ideas out there, and new ones created every day.

Having released three plugins already (not counting the custom ones I wrote), I am aware of some of the limitations of WordPress and wish to share some of the lessons I have learned (and am still learning) about creating WordPress plugins. As a result, I will be starting series that will discuss various topics regarding writing your own WordPress plugin. The series will start off very introductory and will assume your plugin knowledge is zilch.

Who is this Series For?

This series is for any WordPress user who is curious about or wants to learn how to write their own WordPress plugin. Readers of this series will have an intermediate knowledge of PHP, know a little JavaScript, and be decent at Cascading Style Sheets.

This plugin series will benefit theme designers, those that like to tinker with plugin code, and those that are interested in writing their own plugin from scratch.

Tools to Get the Job Done

To write plugins, any text editor will do. Here are the tools I personally use to create plugins.

This series assumes you have WordPress 2.1.x or greater installed.

Code Samples

All code I use will be available for download after each post in the Conclusion section. I will be building the code as I go along, so each download will be different. I will be creating a plugin that doesn’t really do anything other than to show you the basics of how a plugin works.

Since each post in this series builds on top of each other, it is recommended to read this series in the order it is presented.

I highly recommend not using the test plugin on a production WordPress installation. Instead, use a local WordPress installation.

Topics

I plan to start off really basic and move quickly into the more hard-core WordPress plugin functions. This series will not be a comprehensive micro-detail of plugin development, but will hopefully give you a nice foundation to start your own plugin development. If you have any questions or suggestions, please leave a comment or e-mail me using the Devlounge contact form (Ronald). I do ask that you not rely on Devlounge for support and instead use the WordPress Support forums.

Techniques

Some of the techniques I use in my code samples may not be the best way to present code and you may be cringing because I don’t have a lot of shortcuts. I apologize in advance. Everybody has a different coding style.

As far as plugin techniques, structure, behavior, and other nuisances, if there is a better and easier way that I overlooked, I am all ears (er, eyes).

Series Publication Schedule

A post from this series is planned to be published every two days. To stay up to speed on the series, I suggest you subscribe to the Devlounge feed.

Conclusion

Thank you for reading the series introduction. My hope is that this series will prove beneficial to the readers. Any feedback is welcome. Thank you.

End of Article. Copyright Devlounge.
  • Post Time May 7, 2007 at 7:56 am (permalink)

    Great! I’m looking forward to this series because I love WordPress and am using it on 5 different sites. Especially if it will cover code I don’t know or did not find on the official site - like making my life easier or so :-)

  • Post Time May 7, 2007 at 8:04 am (permalink)

    I too am looking forward to this series! My wife’s blog uses wordpress, and I may need to add a little functionality to make things easier for her.

  • Comment Author Igor
    Post Time May 7, 2007 at 8:34 am (permalink)

    Great initiative! I’ll follow this series with great interest!

  • Post Time May 7, 2007 at 2:13 pm (permalink)

    This is the greatest series ever written on Devlounge! I’m looking forward to each of them. I’ve already printed the first two parts of the series and will be studying them very carefully.
    Thanks, Ronald!

    btw, Mac users can install MAMP that will quickly set you up with Apache/MySQL server and PHP.

  • Post Time May 7, 2007 at 9:39 pm (permalink)

    Ron - This is great. I’m glad you’re going to be doing this. I’m looking forward to the series.

  • Post Time May 8, 2007 at 12:26 am (permalink)

    Thank you to all who have expressed interest in the series. The series has been pre-written, so hopefully I will have covered enough ground to establish a foundation for your own plugin development.

    Plugin development is very intensive and I could very well write a book and not cover enough material.

    Thank you for your interest.

  • Post Time July 21, 2007 at 4:18 am (permalink)

    Ronald, you’ve put alot of work into this, great. I wrote a “How to write secure WordPress plugins” paper for blogsecurity.net. It may interest you on this projects (http://blogsecurity.net/wordpress/articles/article-280507/).

  • Post Time December 23, 2007 at 11:22 pm (permalink)

    Thank you so much Ronald. I begin to learn how to write a wp plugin, this is a great start.

  • Post Time April 1, 2008 at 9:56 pm (permalink)

    I am trying to modify your plugin a little. I want it to display the author’s name and URL so readers can click on it. This is the code I have modified

    function addContent($content = ”) {
    $devOptions = $this->getAdminOptions();
    if ($devOptions[’add_content’] == “true”) {
    $content .= “”.$devOptions[’content’];
    $content .= ““.the_author().”“;
    }
    return $content;

    I can’t get WordPress to display the right URL. Any idea what I am doing wrong?

  • Pingback : How to Write a WordPress Plugin Series on May 7, 2007
  • Pingback : Here is your del.icio.us goodness for 05-08 - mattherzberger.com on May 8, 2007
  • Pingback : Devlounge | Friday Focus #30 on May 11, 2007
  • Pingback : HowTos zu Erstellung eines Wordpress Plugins | Bloganbieter.de Blog on May 14, 2007
  • Pingback :   Интересно почитать (15.05.2007) by Блог Димка on May 15, 2007
  • Pingback : WordPress PHP Programming » Getting started with WordPress Plugins on May 16, 2007
  • Pingback : Weblog Tools Collection » Blog Archive » Building your own Wordpress Plugin on May 17, 2007
  • Pingback : WeblogToolsCollection Español » Blog Archive » Creando tu propio plugin de WordPress on May 17, 2007
  • Pingback :   Kendi wordpress eklentinizi yazın | BLOG KAZANI on May 17, 2007
  • Pingback :   Writing your own WordPress Plugin? by MeloVillareal.com on May 17, 2007
  • Pingback : Quick Links May 17 on May 18, 2007
  • Pingback : ¿Cómo crear un plugin para Wordpress? - Carrero Bitácora de los Hermanos Carrero, David Carrero Fernández-Baillo y Jaime Carrero Fernández-Baillo. on May 18, 2007
  • Pingback : Blog Roll España » Blog Archive » ¿Cómo crear un plugin para Wordpress? on May 18, 2007
  • Pingback : braindead1.de » Archiv » Devlounge Serie: How to write a Wordpress Plugin on May 23, 2007
  • Pingback : Yogaf.com » How to Write a WordPress Plugin on May 23, 2007
  • Pingback : How to Write a WordPress Plugin - interessante Beitragsserie at heimo’s blog on May 23, 2007
  • Pingback : Plugin für Wordpress Bastelanleitung - D-SIGN Weblog on May 24, 2007
  • Pingback : NimrodJO Blog | Internet & So Much More » Blog Archive » How To Write WordPress Plug-Ins Series on May 24, 2007
  • Pingback : Devlounge | Friday Focus #32 on May 25, 2007
  • Pingback : When do you Consider you are a Successful Designer? » Inspiration Bit on May 25, 2007
  • Pingback : temporaneità : Post Updated NG 0.3 is out on May 28, 2007
  • Pingback : My blog » Blog Archive » How to write a WordPress plugin on June 2, 2007
  • Pingback : Twelve Puzzle Pieces Of Writing A Series » Inspiration Bit on June 5, 2007
  • Pingback : Mark Kirby - Brighton » Blog Archive » links for 2007-06-06 on June 6, 2007
  • Pingback : Building Wordpress Plugins - mattherzberger.com on June 14, 2007
  • Pingback : How to Write a WordPress Plugin Series | Joomt on June 18, 2007
  • Pingback : » Como criar um plugin para WordPress Ganha dinheiro online com MUIOMUIO.NET: Internet, Tecnologia e dicas sobre Blogging por Mario Andrade on June 24, 2007
  • Pingback : WP Plugins DB » Plugin Details » Post Updated NG on July 10, 2007
  • Pingback : Dr-Hamza’s Space on July 10, 2007
  • Pingback : Learning Things That Captivate » Inspiration Bit on July 18, 2007
  • Pingback : Plugin für Wordpress Bastelanleitung - D-Sign Weblog on July 21, 2007
  • Pingback : Cregy Web Development » Making a Wordpress Theme your own on July 24, 2007
  • Pingback :   Nasıl Wordpress Eklentisi Yazılır ? by # YaMTaR on September 7, 2007
  • Note: If you are commenting here for the first time, your comment will be sent into a moderation queue before being published. Please use your email address in order to identify yourself for your future comments. Clean XHTML: Use standards ready code tags in your comments. For example, cite a comment or phrase from an article with < blockquote > tags.

    About this author

    LoginRonald is frequently found laying his thoughts out in strong, straight-forward articles on various web related topics. He is the author of the popular WordPress plugin Ajax Edit Comments, and writes for WeblogToolsCollection and the Reader Appreciation Project. See more posts by Ronald Huereca, or visit Ronald Huereca's homepage.

    Subscribe

    SubscribeFirst time here, or frequent flyer. Whatever the case may be, we highly recommend subscribing to our feeds so you can get the latest updates without visiting the site. It's just a thought - don't say we didn't tell you so.

    Sponsors

    PSD to HTML, PSD to XHTML Service by PSD2HTML.com. You Design - We XHTML / CSS.

    Related Content

    Close
    E-mail It