All you need to start creating a plugin for WordPress.
We aim to deliver a focus on the API features of WordPress and it's eventual use as a headless CMS, but feel free to use this base for any kind of plugin. It provides several features that will enable you to develop and test your code.
This project is a skeleton, so it has a bunch of keys that need to be replaced with values specific to your project.
For these changes, you should use the "Find and Replace" feature of your editor. Later there will be more options to this. Below you can find the table with the keys and their respective description, along with an example for the possible value.
Key | Description | Example value |
---|---|---|
[vendor_name] |
Your username or company name: no spaces | 26B |
[plugin_name] |
See "Planning Your Plugin – Pick a good name" (more info) | Foo Bar |
[plugin_description] |
Description for the plugin (more info) | A WordPress plugin starter. |
[plugin_url] |
Plugin URL (more info) | https://github.com/26B/wp-plugin |
[initial_version] |
Version to start the plugin with (more info) | 1.0.0 |
[author_name] |
Author name (more info) | Pedro Duarte |
[author_url] |
Author URL (more info) | https://github.com/xipasduarte |
[text_domain] |
Text domain (more info) | foo-bar |
[composer_vendor] |
Your username, company or project name: lowercase and no spaces | 26b |
[composer_name] |
Plugin identifier: usually the [plugin_name] in dash-case |
foo-bar |
[namespace] |
Desired PHP namespace | 26B\WP\Plugin\FooBar |
[autoload_psr_4] |
PSR-4 autoload for [namespace] |
26B\\WP\\Plugin\\FooBar\\ |
[autoload_tests_psr_4] |
PSR-4 autoload for [namespace_tests] |
26B\\WP\\Plugin\\FooBar\\Tests\\ |
For further information on writing WordPress plugins refer to the official documentation.
After all of the changes don't forget to run composer install
to have the dependencies load and the autoload built. (Without this your plugin will break.)