Add New Module

You can add a new module to your themes or your plugins.

Module Folder Structure

Our modules follow special structure. first, you need a module with following folder structure:

Add {module-name}.php file

this is the most important file for your module. in this file you should create base shortcode class for your module and introduce your script as a Site Editor Module.

File Headers

  • Module Name: (required) The name of your module, which will be displayed in the Modules list in the WordPress Admin -> SiteEditor -> Modules
  • Module URI: The home page of the module, which might be on WordPress.org or on your own website. This must be unique to your module.
  • Description: A short description of the module, as displayed in the Modules section in the WordPress Admin -> SiteEditor -> Modules. Keep this description to fewer than 140 characters.
  • Author: The name of the module author. Multiple authors may be listed using commas.
  • Author URI: The author’s website or profile on another website, such as WordPress.org.

Example

 

Add Base Shortcode for Module

A valid Shortcode Class should be extended from “PBShortcodeClass” and this PHP Class  might look like this:

 

Add Shortcode Attributes

You should add your shortcode attributes look like this:

add_shortcode Method

you can do anything you need before loading your shortcode template.

all shortcode attributes will send to shortcode template but you can send new custom variables to it by “set_vars” Method look like this:

 

Add Module Settings

In order to add settings to your modules you need add “shortcode_settings” Method to your base shortcode PHP Class look like this:

Note: You often need to use the same name for a shortcode attribute and related setting it.

Add Panel to Module settings

In order to add a panel to your module settings you need to add your panels to “shortcode_settings” Method look like this:

 

Add Design Options to your module

In order to add design options to your module settings you need to add “custom_style_settings” Method to your base shortcode PHP Class and create and array look like this:

Register your module on the Site Editor

You need to register your module look like this.

Skins as shortcode templates

Skins folders are template system for your module. and each module can have as many as skins you want. skins similar modules follow a special structure like following folder structure:

Add Modules inside your themes or plugins

Now you can add your custom modules but you need to introduce them to SiteEditor Look Like this.