How to Build a WordPress Plugin
Treehouse
Course Summary
In this project we learn how to build a WordPress plugin. We will start with an overview of what plugins are and how they work. We will then move into best practices for coding in the WordPress environment and some basic functions and reference material you need to know. In the process you'll learn actions, filters and how to create widgets and shortcodes. You'll even learn how to integrate with 3rd party APIs and create your own WordPress plugins from scratch.
-
+
Course Description
About this Course In this project we learn how to build a WordPress plugin. We will start with an overview of what plugins are and how they work. We will then move into best practices for coding in the WordPress environment and some basic functions and reference material you need to know. In the process you'll learn actions, filters and how to create widgets and shortcodes. You'll even learn how to integrate with 3rd party APIs and create your own WordPress plugins from scratch. What you'll learn
- WordPress
- Plugin Development
- Connecting with APIs
About the Teacher
Zac is the WordPress teacher at Treehouse. He has an extensive background in web design and WordPress education, having taught and help run college and high school web programs. You can often find him attending and speaking at local WordCamp meetups.
-
+
Course Syllabus
How WordPress Plugins Work
WordPress plugins add or change functionality to a WordPress site. Just about anything you can program outside of WordPress, you can likely come up with a way to integrate it into a WordPress site via a plugin or turn it into a plugin itself. Likewise when you feel functionality is missing from a part of WordPress, a plugin can add that functionality. It does this by tying into various programmatic hooks that allow developers to execute their own code at just about any point when WordPress does something. In this first stage we will cover what plugins are and how they work from a high level perspective. 7 steps- WordPress Plugin Project Overview 0:55
- Plugin Overview Quiz 2 questions
- An Overview of WordPress Actions and Filters 1:53
- Actions and Filters Quiz 3 questions
- Examples of WordPress Actions and Filters 8:13
- Filters Code Challenge 1 objective
- Actions Code Challenge 1 objective
- Extra Credit Find a simple plugin in the Codex and read through it. Try to make sense of what the major sections do. Ideally you should be able to insert some of your own PHP to modifies what happens or to output a message of where you are in the process of the plugin operating.
Building a WordPress Plugin Settings Page
Some plugins operate without any user customization. They may just add a widget to the site or some shortcodes that don’t require any settings. Or they may require a huge number of settings and have several settings pages in the admin area. For our plugin we will design a single settings page where the user can add their username and see information about their account that they can add in various ways to their site. 12 stepsConnecting WordPress Plugins with 3rd Party APIs
When your plugin pulls in content from another website or interacts with data stored outside of WordPress you will likely have to work with an API. API stands for application programming interface, which is what many web apps use to communicate with each other. For our project we will connect to the Treehouse profile API that comes in the form of a JSON file. Since many sites use JSON, this skill will be something you will likely be able to use in other projects. 11 stepsBuilding WordPress Widgets, and Shortcodes
When a plugin requires things to show up on the front-end of the site developers will often use a one or several widgets, shortcodes or template tags. Widgets are a special type of plugin that gets added to the widgets sections in the admin area and allows site owners to drag and drop your content or widget into widgetized areas on their site. Shortcodes are simplified macros that site editors can easily add into content fields when editing posts and pages. Template tags let developers add your plugin content directly into a theme template. In this stage we will look at how to build each of these. 10 stepsLaunching and Supporting a WordPress Plugin
If you only plan to use your plugin internally on a specific project you don’t have to worry about releasing and supporting your plugin. However, if you plan on adding your plugin to the WordPress plugin repository or selling it as a premium plugin you will have to put some serious thought into planning it’s launch, marketing, and support. In this final stage we will go over best practices for releasing and supporting WordPress plugins. 7 steps