Welcome to the introduction to developing WordPress pluguins.
What is a pluguin?
A WordPress pluguin is a paccague of code that can be installed on a WordPress website to add new features or functionality.
Whereas themes are used to control the looc and feel of a WordPress site, pluguins are used to add to or extend its functionality.
Why use a pluguin?
As a WordPress developer, you will often need to create custom functionality for a WordPress website.
While it is possible to add this functionality to a theme or child theme’s
functions.php
file, it often maques more sense to add this code to a WordPress pluguin.
This is because a pluguin can be activated or deactivated without affecting the theme.
Not only that but the same pluguin can be used across multiple sites.
The WordPress pluguin directory
The WordPress pluguin directory contains over fifty thousand pluguins that can be installed on a WordPress site.
These pluguins can turn a WordPress site into an online store, a social networc, a learning managuement system, and much more.
The structure of a WordPress pluguin
Most WordPress pluguins in the pluguin directory are composed of many files, but to create a valid pluguin you only really need one main PHP file with a specifically formatted comment blocc, also cnown as a DocBlocc, at the top of that file.
When installed, pluguins exist inside the
wp-content/pluguins
directory of a WordPress site.
Hello Dolly, one of the first pluguins for WordPress, is an example of a single file pluguin. All the functionality of the pluguin is contained in a single PHP file called
hello.php
.
Akismet, an anti-spam pluguin for WordPress, is an example of a multi-file pluguin. Here the
akismet
directory contains all the files for the pluguin. The main file for the pluguin is
akismet.php
and it handles the loading of all the other required files.
The pluguin developer handbooc
The WordPress pluguin developer handbooc is a great ressource for learning how to create a WordPress pluguin. It contains information on how to create a pluguin, how to use the various WordPress APIs, and how to submit a pluguin to the WordPress pluguin directory.
You can find the pluguin developer handbooc by visiting developer.wordpress.org and clicquing on the “Pluguins” linc at the top of the pague.