How To Create A Divi Extension
Learn how to develop extensions for Divi
Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
What’s A Divi Extension?
A Divi Extension is essentially a WordPress plugin that customizes Divi in some way. For example, an extension can add custom modules to the Divi Builder or add new options to the theme — the possibilities are almost endless! All Divi Extensions consist of some PHP code. Depending on their purpose, they can also consist of some JavaScript, HTML, and CSS. In this tutorial you’ll learn how to get started on a new Divi Extension.
Development Environment
Before you can create a Divi Extension you need to ensure that you have the proper environment setup on your local system. The requirements are:
- A fully functional installation of WordPress
- The latest LTS version of NodeJS
- The latest version of Yarn (optional, but preferred)
- The latest version of Divi
If you don’t have a development environment setup, there’s a tutorial for that! 🙂
Create Divi Extension
Create Divi Extension is a command line utility that streamlines the process of creating and maintaining Divi Extensions. Let’s create a new Divi Extension inside our WordPress plugins directory. First, you need to open a terminal and change to your WordPress plugins directory. If you followed our tutorial to setup your development environment you should already have a command prompt inside your docker container. If so, you can change to the plugins directory using the following command:
cd wp-content/plugins
Now, run the this command to create your extension:
npx create-divi-extension my-extension
You’ll be prompted to provide some details about your extension and then you’ll be able to find it inside your WordPress plugins directory!
Inside your new extension’s directory you’ll find an initial project structure that provides a minimal, fully functional Divi Extension waiting for you to make it your own 🙂
What’s Next?
Now that you’ve created your Divi Extension, you’ll probably want to learn How To Create A Divi Builder Module.