Planning a WordPress Plugin

by Buddy Lindsey on February 17, 2010

Wordpress Logo

This isn’t going to be your normal wordpress plugin tutorial series. We are actually going to build a useful wordpress plugin most bloggers probably would need. Especially bloggers who program.

Some of the most common reasons people build plugins are:

  • WordPress functionality Doesn’t exist
  • Plugin doesn’t exist
  • Don’t like how existing plugin works
  • Unable to find the plugin you need
  • Want to create it yourself for experience

For this plugin it falls into, probably, most of those above.

What is the Plugin

By now you probably want to know what the plug-in is going to be. I’ll quote the concept so its better to understand it.

This is a plugin to allow you to manage your list of posts in the series you are writing. Instead of managing the list at the top of all your posts you can add a simple line to your page to manage it in the admin section of your site in one spot. So it is a table of contents for series.

The great thing about this plugin is it is simple enough to do a series on, but touches a lot of what other plugins do so you get a good feeling of how to do many different parts writing a plugin. Now we have what the plugin is for and will do, lets look at the steps. I like to do this by stepping through workflow of how you would work with this plugin, so we only get what we need.

Workflow of Using the Plugin

This is the workflow I would probably use if I had this plug-in.

  1. Make a post
  2. Make second post
  3. Get links to both posts
  4. Open the plugin admin panel in the admin section of wordpress
  5. Create new ID for the series ex: 1, 2, 3
  6. Make an easy to remember title for the series
  7. Add Links to the posts in a text field
  8. Save it
  9. Add string to top of the two posts with the id of the Table of Contents ex: [toc=2]
  10. Update the posts
  11. View the post to confirm it is there
  12. Make another post and add the string to the top
  13. Go back to admin panel for plugin
  14. Choose the title we created earlier for that series
  15. Add link to the existing ones
  16. Save updates
  17. Confirm it all worked by opening up the post

That is probably the longest way to use this plugin, but probably the best way to figure out what is needed by figuring out the robust usage. These steps make sure you walk through your the usage instead of just thinking you know what is needed. Now lets figure out what needs to be coded up.

What to code

  • Add Link to the Admin Panel in Settings section of admin panel
  • Create page for editing settings and adding new table of contents
    • have a list of existing TOC listed by title with an edit button and id number
    • have text field for “title”, “ID”, and “all the links”
    • have save button for new entries and updates
  • Every time the post is displayed it reads the code with the ID, and injects the links in
  • On display options where it only shows summaries the TOC doesn’t show up

Those are essentially all the elements we have to code up. Though, doing it might be a bit more complicated than listed. As mentioned before this series will cover a lot of topics; below are some of the topics we are going to cover in this series.

Topics

There are several of topics with doing a wordpress plugin here is a list of the bigger ones we will discuss

  • The Loop
  • Creating Admin Section
  • Getting Plugin to Show-up in Plugin section
  • WordPress Database Access
  • Plugin Hooks
  • Plus more…

Conclusion

This hopefully is a good overview of what we are going to be doing in this series. Obviously once the plugin is done it is going to have an immediate benefit of using it on this series.

This is a good starting place for this plugin. In the course of writing this I have thought of many additional features which can be added to make life a whole lot easier and this plugin better. However, it would tack on a lot of extra posts, and would detract with the concept of this series; which is to hit many of the topics other plugins use without writing HUGE complex plugins.

I hope you enjoy this and any feedback is welcome and encouraged.

Related Posts:

Was this Helpful?

If you found this article useful you might find others useful as well. Please browse the archives and subscribe to the RSS Feed to stay up-to-date.

erich November 20, 2010 at 10:29 am

I would like to learn to write a plug in. Has this series started / continued?

Reply

Buddy Lindsey November 21, 2010 at 4:59 pm

I do plan to continue this. Some things change in WP since I first started this and haven’t had a chance to rewrite the plugin even better. I hope to get it re-written by the end of the year and start posting on it again sometime in January.

Thanks for the interest in it. If you have specific things you would like to know please let me know.

Reply

Leave a Comment

Previous post:

Next post: