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.
When you get down to it, there's one key element that allows for WordPress plugins, and that's the hook. Hooks are also known as actions and filters. They're basically points in the WordPress life cycle that go out and look for registered programming pieces to execute. This can occur when a user requests a page, when an admin page is created, when an admin menu is created, when the author submits a post, or at myriad of other places throughout WordPress. All of these pieces have hooks related to them. All we need to do to make a plugin work then is register a function to a specific hook, and bam: that's really all there is to it.
That piece of code will execute when that hook occurs. WordPress hook started back in version 1.2. Before that, WordPress hacking was literally that. It was taking the original code and hacking away at it. When they added hooks, essentially what they did is they added points in the code that would look to see if anything was registered to execute at that particular point. So, for example, when the user submits a comment, there is a hook there. If you want something to happen, then you can write a function that will send out an e-mail, and then you add it into that hook.
Or let's say you want to add something to a menu in admin. You can write a function that generates some user interface, some display, and then simply add a hook. That hook will then add your piece of user interface into the display of the Admin menu. So the process of plugin development is really writing a function that does something, then finding the correct hook when you want that thing to occur, and simply registering your function with that hook. As a WordPress developer, a key part of getting started is using the WordPress Codex.
The Codex is really the user manual for WordPress, for everyone, whether they're an administrator or developer. But from a developer standpoint, we have a list of all kinds of stuff: specifically here at codex.WordPress.org/plugin_API. It's a great jumping point to get started. It will explain hooks, actions and filters, what they are, and it will also tell you some examples of actions and also of filters, and we'll talk about the distinctions in these later when we get into development.
In addition, Adam Brown at Brigham Young also has a database of all the WordPress hooks, called the WordPress Hooks Database at adambrown.info. So the key to plugins is the hook. The process of developing a plugin is really the process of writing a function, registering it with a hook, and then whenever that occurs in that process when the user uses your plugin, your functionality will occur.
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.