Skip to content

Custom modules

Robert Isoski edited this page Feb 4, 2022 · 7 revisions

Custom modules are a way of adding, creating and sharing themes/plugins (modules)

The "Custom modules" field in the Settings->Themes or Settings->Plugins also enables you to install a theme (or plugin) that is not listed in the official WonderCMS repository.

Custom modules can be used to serve your theme or plugin to other users. There are some full project examples which can be copied at the bottom of this document with some more helpful links.

How to create a custom module

As a plugin or theme maintainer, a few files must be provided for these modules to be correctly installed for WonderCMS users.

  • Custom theme module requirements

    Your theme module must include the following files:
    • theme.php contains your theme and all WonderCMS theme elements
    • style.css must be inside a /css folder
    • preview.jpg compressed screenshot of your theme
    • wcms-modules.json file with the following fields below
{
    "version": 1,
    "themes": {
        "theme-name": {
            "name": "Name of your theme",
            "repo": "https://github.com/yourUsername/theme-name/tree/master",
            "zip": "https://github.com/yourUsename/theme-name/archive/master.zip",
            "summary": "My sample theme",
            "version": "2.0.0",
            "image": "https://raw.githubusercontent.com/yourUsername/theme-name/master/preview.jpg"
        }
    }
}

Note: Leave the first version: 1 at the top as it is, it is used for reading the format of the module.

  • Custom plugin module requirements

    Your plugin module must include the following files:
    • plugin-name.php contains your plugin code
      • IMPORTANT: plugin-name.php must be the same as the plugin folder name
    • preview.jpg compressed screenshot of your plugin
    • wcms-modules.json file with the following fields below
{
    "version": 1,
    "plugins": {
        "plugin-name": {
            "name": "Name of your plugin",
            "repo": "https://github.com/yourUsername/plugin-name/tree/master",
            "zip": "https://github.com/yourUsename/plugin-name/archive/master.zip",
            "summary": "My sample plugin",
            "version": "2.0.0",
            "image": "https://raw.githubusercontent.com/yourUsername/plugin-name/master/preview.jpg"
        }
    }
}

Note: Leave the first version: 1 at the top as it is, it is used for reading the format of the module.

Installing module (theme or plugin) to your website

After finishing creating a custom theme/plugin module, login to your website and open Settings -> Themes or Plugins and scroll to the bottom.

Paste your full wcms-modules.json URL

  • example: https://raw.githubusercontent.com/yourUsername/theme-name/master/wcms-modules.json) and click "Add". Your module (theme/plugin) should be now listed in the Settings -> Themes/Plugins section. Reopen settings to install it.

How to send a theme/plugin update to users or your website

  • Make new changes to your theme/plugin files.
  • Change the version file in the wcms-modules.json (eg: from 3.0.0 to 3.0.1) after you've confirmed everything is working.
  • Users will receive an "Update" notification in their Settings panel.
    • This will happen either after 24 hours after logging in OR when the users manually click the "Check for updates" button in the Settings panel.
  • When "Update" is clicked, the users existing theme/plugin (from your changed files) will be overwritten with the latest ones from your theme/plugin changes.

How share your theme/plugin

  • After you've created a Custom module as shown above, simply share the link.
  • Share your creation with our community.
  • If you're confident in your module, you can create a pull request to the official WonderCMS theme/plugins repository and CDN with your theme/plugin URL.
    • Pull requests can be made to the themes-list.json or the plugins-list.json.

Example projects to fork/clone

Clone this wiki locally