Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
In WordPress: Creating Custom Widgets and Plugins with PHP, Drew Falkman teaches PHP developers how to create custom functionality for WordPress 2.0 through 3.0 using widgets and plugins. This course starts by installing and setting up WordPress 3.0 on both Mac and Windows, then provides an in-depth look at tasks related to these WordPress add-ons: installing and administering, building and customizing, creating editable options and database tables, working with posts and pages, and utilizing jQuery and AJAX. There are also tutorials dedicated to promoting a widget or plugin, adding security, and localizing the interface. Exercise files are included with the course.
Just as every journey starts with the first step, every application starts with a single piece of code. In the case of WordPress plugins, we start by creating the main PHP plugin file. This file has a predefined comment section, called the headers, that is used by WordPress to essentially register and make your plugin available to a WordPress installation. In order to create this, we are going to go in to PDT, and we are going to go in to our plugins directory, which is in wp-content/plugins. We are going to right-click, and go to New > PHP File.
You can name it whatever you want. In this case, we are just going to call it first_plugin and hit enter, and here we have it. So I am going to start with a comment block, and inside this comment block, I need to put some standard information. I am going to put Plugin, and it's important you spell it the same way as I'm doing here. This is part of the WordPress standard plugin. "Drew's Awesome Widget." The Plugin URI, it's going to be a web site that will have information about this plugin.
So it would probably be a web site somewhere in your domain. So "falkonproductions.com/first_plugin." Then you put a description of your plugin. "This plugin does awesome things." The Author, that's you; the version, 1.0, and lastly the Author URI, which is your web site.
When you are done, you can go ahead and save it. If you log into your WordPress administrator wp-admin and go to the Plugins page, you will now see your plugin has been registered. All this information was obtained by going through and looking in the Plugins Directory and finding any PHP file that had those comment headers. It then outputs everything here. Notice it is not activated, so it's not actually plugged in. Even if it were, there is nothing there; I haven't written any functions or created any hooks or anything.
But it does have the name, my plugin, the description, the version, the author name, and the links to my web site and a link to the plugin web site. One last thing I wanted to go over is licensing. The standard license is the GNU, General Public License's version 2, and you can find it at codex.WordPress.org/Writing _a_Plugin, and you can see it has the standard license built-in. It's not necessary that you include this, but it is fairly customary, especially if you are going to post it on the WordPress.com site.
So that's the beginning part of creating a PHP plugin: creating the comment header, describing your name, the URI of the plugin, the description, the author, the version, and then your URI as well. This will register it in a WordPress installation, and then anyone can start to use your plugin.
Find answers to the most frequently asked questions about WordPress: Creating Custom Widgets and Plugins with PHP.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.