Easily extend YOOtheme Pro with the YOOtheme Starter Plugin. It's a ready-to-use starter kit that takes care of all the tedious tasks, like the integration into Joomla or WordPress, and helps with distribution, versioning and updating of your YOOtheme Pro extension, so you can focus on the actual features.
The YOOtheme Starter Plugin is the easiest way to share your custom YOOtheme Pro functionality across multiple client projects by distributing it as a WordPress or Joomla plugin. It handles installation, publishing, versioning, and 1-click updates for WordPress, Joomla, or both. Get started quickly using helpful commands to generate example code to extend YOOtheme Pro in various areas, such as:
You can also find the YOOtheme Starter Plugin on Github.
Note For small customizations which are only used in a single project, creating a YOOtheme child theme is a sufficient alternative to the starter plugin.
Install Composer v2.5+, which is used to install PHP packages.
Also, use Node and npm to install Task, which is needed to run build tasks.
npm install -g @go-task/cli
To create a new plugin, run Composer's create-project command in the plugins folder of WordPress wp-content/plugins or Joomla plugins/system. Replace PLUGIN_NAME with the name of your plugin, for example myplugin.
composer create-project yootheme/starter-plugin PLUGIN_NAME
Now run the create:plugin command in the newly created plugin folder.
composer create:plugin
You will be asked for additional plugin information which will be used in the plugin metadata.
My Pluginhttps://example.comhttps://example.com/updatesThis will create the required plugin files in the build folder and the .env configuration inside your plugin folder.
.
├── build # Plugin blueprint files
│ ├── joomla
│ ├── myplugin.php # Joomla plugin
| ├── myplugin.xml # Joomla plugin metadata
│ ├── wordpress
│ ├── myplugin.php # WordPress plugin
| └── Taskfile.yml # build tasks
├── .env # Metadata
├── vendor # Development dependencies
├── README.md
└── Taskfile.yml # Main Taskfile
To make your new plugin available in WordPress or Joomla, run the corresponding setup task in the plugin root folder. This will copy the necessary plugin files from the build folder to the plugin root folder.
task setup-wordpress
task setup-joomla
Now the plugin can be discovered and installed in WordPress or Joomla.
To create a new YOOtheme Pro module, which is a package of code that extends the functionality of YOOtheme Pro, run the following command and replace MODULE_NAME with the name of your module, for example my-module.
composer create:module MODULE_NAME
You will be asked further questions to configure the module.
MyPlugin\MyModuleRead the Modules documentation to learn more about the created files and code examples.
Note: Add wordpress or joomla to the name for system-specific modules, for example my-module-wordpress or my-module-joomla. The build tasks will only copy the relevant modules into the WordPress and Joomla zip archives.
To create a new element, run the following command and replace ELEMENT_NAME with the name of your element, for example my-element. If there are multiple modules, choose a module from the provided list.
composer create:element ELEMENT_NAME
Optionally, define the module where the element should be created.
composer create:element ELEMENT_NAME MODULE_NAME
You will be asked further questions to configure the element.
My ElementCustom.Read the Elements documentation to learn more about the created files and code examples.
To create an installable zip archive of the plugin for WordPress and Joomla, run the following build task. The created zip files are located in the dist folder.
task build
Alternatively, create the archives individually.
task build-wordpress
task build-joomla
To raise the version number of your plugin or change metadata, like the plugin title or description, edit the .env file in the root folder.
TITLE='My Plugin'
NAME='myplugin'
VERSION='0.0.1'
DESCRIPTION='Lorem ipsum'
DATE='{{ now | date "2006-01-02" }}'
COPYRIGHT='Copyright (C)'
LICENSE='GNU General Public License'
AUTHOR='My Company'
AUTHOREMAIL='me@example.com'
AUTHORURL='https://example.com'
After changing the metadata, re-run the corresponding Joomla or WordPress setup task to update the plugin files and run the build task to create new distribution files.
To enable 1-click updates in WordPress and Joomla, run the build task to generate the necessary update server files for WordPress dist/update.json and Joomla dist/update.xml. These files are configured based on the package information in the .env file.
# Update server
UPDATEURI='https://example.com/updates'
# Package information
STABILITY='stable'
DOWNLOADURL='https://example.com/downloads'
PHPMINIMUM='7.4'
JOOMLAMINIMUM='(5\.[01]|4\.[01234]|3\.10)\.'
WORDPRESSMINIMUM='6.2'
Upload these files to the UPDATEURI URL. This URL is where your plugin checks for updates and retrieves the associated download file. Ensure the zip archives from the dist folder are uploaded to the location specified in DOWNLOADURL.
The command and task scripts have their own starter-utils Github repository. To update the package to the latest version, run composer update from time to time.
To make your plugin a Git repository use git init -b main and follow the steps under Adding a local repository to GitHub using Git.