How to Write a WordPress Plugin, written by Ronald Huereca is an extensive, twelve entry series on the process of creating your own. http:// WordPress Plugins allow you to easily modify, customize, and enhance a The first task in creating a WordPress Plugin is to think about what the Plugin will do, .. part “How to Write a WordPress Plugin” at by Ronald Huereca .

Author: Akinom Goltikinos
Country: Montserrat
Language: English (Spanish)
Genre: History
Published (Last): 7 April 2011
Pages: 291
PDF File Size: 11.61 Mb
ePub File Size: 10.79 Mb
ISBN: 635-7-55199-442-6
Downloads: 65195
Price: Free* [*Free Regsitration Required]
Uploader: Barg

The above function will accept one variable named content. Conclusion You can have the best plugin in the world, but if it isn’t released wrote promoted correctly, very few people will download it. Topics I plan to start off really basic and move quickly into the more hard-core WordPress plugin functions.

Some template tags will not work outside of this loop, so it is imperative that you know exactly where your code is executing.

A Place to Store the Variables One of the first problems you will likely encounter when constructing your own admin panel is where exactly to store the variables. If your plugin is good enough, the referrals will start coming aordpress.

Devlounge – How to Write a WordPress Plugin_百度文库

It is very useful for users of the Plugin if you create a web page to act as a source of information for your WordPress Plugin. This article assumes you are already familiar with the basic functionality of WordPress and with PHP programming. Any files other than the main plugin file should be included in sub-directories. You can also dig the article from that page and show your support.

How to Write a WordPress Plugin | Devlounge

Applying Filters One of the more powerful things you can do with filters is to call then dynamically. The beauty of template tags is that you can re-use them over and over for your theme and any future ones vevlounge build. For instance, if your Plugin is worcpress to be called “Fabulous Functionality”, you might call your PHP file fabulous-functionality.


There should be some kind of function that is called that also retrieves the admin options. As a result, I will be starting series that will discuss various topics regarding writing your own WordPress plugin.

I typically structure my plugin in this folder structure: The next step is to create a PHP file with a devloungee derived from your chosen Plugin name. Another area is the WordPress ideas page. Set Up Actions and Filters The next bit of code sets up a place holder for WordPress actions and filters which I will go over in a later post. Usually one of the first things I do when I install or test a new plugin is to look at the code and see what I can modify, what I cant modify, and what I can possibly add or take away.

Someone who wants to use your Plugin can add these “tags” to their theme, in the sidebar, post content section, or wherever it is appropriate.

Display the admin panel options. Here’s the function I inserted in the DevloungePluginSeries class: In the event the plugin author is unable to your needs, it will be up to you to take the initiative and modify the existing plugin code.

Output notifications if form data is present. Retrieved from ” https: You are a theme designer I would argue that if you are a template designer for WordPress, the next logical step is to be a plugin author. Want content at the end of the post to show only if the admin has this enabled already.


Most of these problems can be solved during testing, but some bugs just don’t seem to crop up until after the official release. The changes will be publicly visible, but only to the technically-minded people checking out your Plugin via SVN.

About Devlounge Want to read more about Devloungeor maybe you want to contact usor even advertise? The options are returned for your use line You can download the full length PDF which includes all code samples and images — just like the live versions of the articles! I would argue that a good plugin requires absolutely no theme manipulation or file manipulation.

Assuming that your Plugin has some options stored in the WordPress database see section aboveyou will probably want it to have an administration panel that will enable your Plugin users to view and edit option values.

This file name is often, but not essentially, the same as the directory name. This page will be the URL that people will go to to find out everything about your plugin.

Set Your the Default User Options You’re going to need a place to initialize your user options, especially when a user first activates your plugin. If so, it erite them in turn.

Each plugin author is different in the way they structure a plugin, so these tips are merely my own personal preference.