Plugins for WordPress blogs differ from themes but share the same features


Anatomy of a WordPress Plugin

It goes without saying that plugins are different from themes, but a lot of things concerning them share the same ground. If you simplify things, you could say that when you’re adding functionality to your theme by adding code to the functions.php template file, you’re actually writing a plugin. But there is a huge difference. Themes are there to display the WordPress site, using the tools available. Plugins, on the other hand, are used when you need to extend the WordPress functionality with additional features. You should remember that, because bloating your theme’s functions.php with features sometimes isn’t the way to go.

In this article we’ll look at plugins from a slightly different standpoint than we did with the themes articles previously. The reason for this is simple: your plugin can do anything. It is basically a way for you to add whatever feature you want; compare that to doing funky stuffwith a select few template tags, and you see the difference. With plugins, it is not a matter of what you can do, it is more a question of why. So that’s where we’ll start.

Plugin Basics

A plugin’s essentials don’t differ too much from a theme’s essentials. Instead of the necessary style.css stylesheet file with its theme-identifying top header, you have an aptly named PHP file with a similar header. Then you can expand by adding even more functionality outside of the main plugin PHP file if you want, just like you add template files to the child theme’s style.css. Start from the beginning: the main plugin file. There are just two things to observe here:

Giving your plugin a unique filename or folder name is very important, since plugins reside in wp-content/plugins/ and you wouldn’t want any weird conflicts. Name it appropriately, and in such a way that there is no doubt which plugin it is should someone need to find it using FTP but only know it by the name it is displayed with from within the WordPress admin interface. The identifying plugin header block will look familiar.

Actually, you don’t need all that; only the plugin name line, the first one within the comment notations, is mandatory. The rest should be there, however, so that the user knows what the plugin is, where to get updates, version numbering, who made it, and so on. You should include licensing information as well. This is the standard GPL licensing dummy that is recommended in the WordPress Codex.

Naturally, you’d want to change YEAR and PLUGIN AUTHOR E-MAIL to the correct information. You can also include the full license as a text file, aptly named license.txt of course. Obtain the license from www.gnu.org/copyleft/gpl.html. And that’s about it. All you need for WordPress to find the plugin is this, one single file with an identifying top. Dropping it in wp-content/plugins/ will result in it being listed in the Plugins section within WordPress. Activate it, and it will be available to you in your theme, and from WordPress’s actions themselves. This is where the fun part begins, because this is where you have to figure out what you need to do, and how you’ll accomplish it. Whether you’re planning on writing the plugin you think will change the way you use WordPress, or just need some extra functionality for your latest project, you should go through the plugin checklist before getting started. It may just save you some time and headaches.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.


This article was sent to us by: Natalie Kens at 05212010

Related Articles

1. Creating Your Own Wordpress Template Tags
Creating Your Own Template Tags Another way to access your plugin functionality is by creating your own template tags, much like bloginfo(), the_title(), and so...

2. Things to Consider When Using the wordpress Database
Things to Consider When Using the Database The database is sometimes necessary to make your plugins function the way you want. From storing some simple options,...

3. Developing Plugins for WordPress MU
Developing Plugins for WordPress MU The process of developing plugins for WordPress MU doesn’t differ from that for traditional Word- Press plugins. The s...

4. Wordpress Plugins and Functions PHP
Plugins and Functions PHP WordPress themes and plugins usually work pretty much by themselves, coming together only when it comes to implementing features. Th...

5. When to Use Wordpress functions php
When to Use functions.php When, then, is it really a good idea to use functions.php? I have a rule for that too: only use functions. php when the added function...

6. Are you using WordPress as a CMS
WordPress as a CMS Using WordPress for things other than blogging is something that comes naturally to a lot of developers today, but not so much for the ge...

7. Things to Consider When Using WordPress as a CMS
Things to Consider When Using WordPress as a CMS So you’re considering using WordPress as a CMS for a project huh? Great, and probably a good choice too...

8. Trimming WordPress to the Essentials
Trimming WordPress to the Essentials Usually, when doing work for clients or other people within your organization, you’ll have to think a little bit diff...

9. Wordpress Static Pages and News Content
Static Pages and News Content I touched upon static Pages and categories as a news model previously. It is truly a great tool whenever you need to roll out a ty...

10. Making Widgets a Little More Dynamic
Putting Widgets to Good Use Widgets and widget areas are your friends when rolling out WordPress as a CMS. It is perhaps not as important for the small and stat...