Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101038 Viewers
61 Video lessons · 87827 Viewers
71 Video lessons · 71703 Viewers
56 Video lessons · 103586 Viewers
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.
Your file was successfully uploaded.