Are you writing your first WordPress plugin? One way of the best ways to learn how is to read other plugins’ code; most of which you need to do has probably been written by someone else before. You can also use this code generator that produces a template for your WordPress plugin, which you can fill with your code and distribute to the community.

But why would you want to write a WordPress plugin? There are enough reasons to get you started, not to mention that it’s fun and quite easy to do with all the resources available.