Join Carrie Dils for an in-depth discussion in this video Finding references and documentation, part of Advanced WordPress: Action and Filter Hooks.
- [Instructor] In this chapter, I'd like to switch gears a little bit. We got to build a simple plug-in in the last chapter, but now I want to look at how to dig in to the Wordpress documentation. We've already looked a little bit, here, at the Wordpress codex and at the developer's code reference. We've even looked at some source code for Wordpress. What I'd like to do now, is show you how to best use these resources to find the information you need. Sometimes, it's going to feel a little like a scavenger hunt. You'll find one piece of information that gives you a clue to look for the next one, and so-forth.
So, I'm going to go ahead and start here at the main codex page. And note that there's a section, here, on writing a plug-in. If we look at that, this Writing a Plugin page is a great resource that walks you through all the basics you need to know. From the table of contents, here, you can see that it covers file naming, and structure, using hooks, template tags, interacting with the database, and so forth. There's also information on internationalizing your code in order to make it translation-ready.
Let's go back to the main codex page, and next we're going to take a look at the plug-in API. This is the primary resource we're using in this course, as it links to full documentation on all action hooks and filters. I won't spend a lot of time, here, since we've already looked at it quite a bit. Heading back, let's look at this, Plugin Resources. And this is sort of a one-stop-shop for all things plug-ins. So, some of these links are to other pages in the codex, and some of them are to external articles.
One thing I do want to point out here: Wordpress is open source software, and the documentation is open source, too. Meaning that it's a wiki created and maintained by other Wordpress developers. As a matter of fact, anyone with a wordpress.org account can contribute to this documentation. And where there are humans, of course there are errors. So it's possible that you could come across some code examples that haven't been updated in a while or maybe weren't the best examples to begin with, but generally speaking, those will be the exception, not the rule.
But, it's worth a mention. Trust, but verify. If you scroll down to the bottom of just about any page in the codex, not just this one, you'll find related documentation as well as some external articles that are relevant to the page's topic. These sections are nice supplements as you find yourself looking for additional clues on how something works. Of these resources, the one that I want to point out to you, is the Plugin Developer Handbook. For the most part, this is a more recent addition to Wordpress documentation, and isn't really different from the codex in terms of the information, I just think the design is a little more user friendly, and the flow of information makes more sense, to me at least.
So, everything that we've just looked at, these are going to be your best friends. One other thing I want to mention, that depending on what code editor you're using, there may be packages available that give you access to Wordpress documentation, or even code snippets from directly within your code editor. For instance, here are some Wordpress related packages for Sublime Text. There are also a number available for Atom, and if you're using PHPStorm, here's an excellent article on Wordpress integrations. Those are just a handful, but do a Google search for whatever code editor you use, and Wordpress packages, to see what comes up.
Those could be major time savers during your development process.
- Actions and filters explained
- Identifying available hooks and filters
- Looking at load order
- Understanding callback functions
- Creating custom hooks
- Using third-party hooks
- Building a new WordPress plugin with filters and actions