How To Create a Custom Field For a Divi Builder Module

How To Create a Custom Field For a Divi Builder Module

How To Create a Custom Field For a Divi Builder Module
Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required. Custom Fields for Divi Module Settings Creating a custom field for a Divi module is similar to creating a custom Divi module in the Divi Builder. Both methods require some Javascript, HTML, & […]

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
Custom Fields for Divi Module Settings
Creating a custom field for a Divi module is similar to creating a custom Divi module in the Divi Builder. Both methods require some Javascript, HTML, & CSS code. However, to create a custom field for a module, there is no need for any PHP because you don』t need to write a PHP class to render the HTML output on the frontend. The main component needed is a ReactJS component class that handles rendering the field inside of the Divi Builder. Then you can define the custom field on your module definition.
In this tutorial, you』ll learn how to create custom fields for a Divi Builder module that will be fully functional in the builder.
Getting Started
Keep in mind. Custom Divi Builder fields must be implemented within a theme, child-theme, or Divi Extension. In this tutorial, we』re going to create a custom field for a custom module in a Divi Extension.
Also, this tutorial is a continuation of previous tutorials that have a specific setup already in place.
If you haven』t already done so, go ahead and do the following before you start this tutorial:

Create a Divi Extension
Create a Custom Module.

Once done, you are ready to continue.
Run Yarn
Before we can test our custom field later on in the Divi Builder we』ll need to compile the JSX code into regular JavaScript. To do that, we need to run yarn. To do this, simply run the following command inside your plugin』s directory:
yarn start
IMPORTANT: Be sure that yarn start is running in the root folder of your plugin. Furthermore, you should keep yarn start running as you develop so that the files continue to compile successfully.
Upgrading Divi Scripts
Custom Divi Builder Fields is a new feature and only available on divi-scripts version 1.0.2 above. So, if you want to add custom field on your existing extension, please upgrade your divi-scripts to version 1.0.2. You can do this by changing divi-scripts version on your package.json located at at the root of your extension directory.

Then run yarn install to update. You can also find a custom field example on this documentation here.
Update Field Directory and File Names
We』ll get to update the code in our files in a bit. But before we can do that, we need to change the default directory and file names for our new custom field.
Look inside your extension』s directory and locate the example custom field located at /includes/fields/Input/Input.jsx.

We』ll use this as a starting point to create a custom input field.
First, rename the Input directory to SimpleInput.
Inside the directory (now named SimpleInput), rename the file Input.jsx to SimpleInput.jsx.
The path to the file should now be includes/fields/SimpleInput/SimpleInput.jsx

Update the Field File
Open the SimpleInput.jsx file and edit it as follows:
Update the React Component Class
For our custom field to be available and fully functional inside the Divi Builder we must create a React Component class that handles the rendering of our custom field based on its props.
By default, the component class is named Input. Change the name of the class Input to SimpleInput.
Then change the name Input to SimpleInput at the bottom of the file to reflect the new name of our component class in order to be exported for use.
Also make sure to update the slug, input id, and input className to reflect the name of the new field.
(NOTE: Depending on the prefix id you chose when setting up your Divi Extension, you may see different names for the static slug, input id, input class, etc. This example has the prefix simp which was chosen when creating the Divi Extension.)

Here is an example of what the code should look like after the change has been made:
// External Dependencies
import React, { Component } from 'react';

// Internal Dependencies
import './style.css';

class SimpleInput extends Component {

static slug = 'simp_simple_input';

/**
* Handle input value change.
*
* @param {object} event
*/
_onChange = (event) => {
this.props._onChange(this.props.name, event.target.value);
}

render() {
return(

);
}
}

export default SimpleInput;

The _onChange() prop is a method handler to save or remove the field setting』s value. It passes 2 parameters.

The first parameter is the field setting』s name. You can use name prop here because it』s already supplied with the correct field name based on the current active tab mode. For example: when you are editing the Title option in Tablet tab mode, the field』s name generated is title_tablet. The second parameter is the field setting value that you want to save.
The field setting type is actually a third parameter that is automatically defined with the current field type prop. So we don』t have to include that parameter with the other 2.
Update the index.js file for the Custom Field
Next, let』s update the import and export statements in the index.js file located at /includes/fields/index.js. To do this, open to edit the index.js file.
Replace all instances of the name for the class and directory (which is Input by default) to the new name SimpleInput.

Here is an example of the final code:
import SimpleInput from './SimpleInput/SimpleInput';

export default [SimpleInput];

Custom Field CSS Styles
Styles for our custom field can be defined using the style.css file in its directory located at /includes/fields/SimpleInput/style.css.

Our custom field is only a basic input element that comes with default builder styling. For now, let』s change the default class selector to .simp-simple-input (rendered in SimpleInput.jsx) throughout the style.css file:
input.simp-simple-input {
background: #f1f5f9;
max-height: 30px;
border: 0;
border-radius: 3px;
padding: 7px 10px;
box-sizing: border-box;
transition: background 200ms ease;
color: #4C5866;
font-family: 'Open Sans', Helvetica, Roboto, Arial, sans-serif;
font-size: 13px;
font-weight: 600;
line-height: normal;
display: block;
width: 100%;
}

input.simp-simple-input:focus {
background: #e6ecf2;
}

input.simp-simple-input::-webkit-input-placeholder {
color: #98a7b8;
}

input.simp-simple-input:-moz-placeholder {
color: #98a7b8;
}

input.simp-simple-input::-moz-placeholder {
color: #98a7b8;
}

input.simp-simple-input:-ms-input-placeholder {
color: #98a7b8;
}

input.simp-simple-input[readonly] {
background: #ffffff !important;
border: 1px solid #eaedf0 !important;
cursor: not-allowed;
}

Field Definition
To use our custom field, we need to define it on the module definition of our intended module. For this example, let』s add it to the Simple Header module we created in the previous tutorial.
Open the SimpleHeader.php file located at /includes/modules/SimpleHeader/SimpleHeader.php.
Then add the code to define the custom field. Don』t forget to use simp_simple_input as the field type.

The final code will look like this:
class SIMP_SimpleHeader extends ET_Builder_Module {

public $slug = 'simp_simple_header';
public $vb_support = 'on';

public function init() {
$this->name = esc_html__( 'Simple Header', 'simp-simple-extension' );
}

public function get_fields() {
return array(
'heading' => array(
'label' => esc_html__( 'Heading', 'simp-simple-extension' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => esc_html__( 'Input your desired heading here.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
'content' => array(
'label' => esc_html__( 'Content', 'simp-simple-extension' ),
'type' => 'tiny_mce',
'option_category' => 'basic_option',
'description' => esc_html__( 'Content entered here will appear below the heading text.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
'field' => array(
'label' => esc_html__( 'Custom Field', 'simp-simple-extension' ),
'type' => 'simp_simple_input',
'option_category' => 'basic_option',
'description' => esc_html__( 'Text entered here will appear inside the module.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
);
}

public function render( $unprocessed_props, $content = null, $render_slug ) {
return sprintf(
'

%1$s

%2$s

',
esc_html( $this->props['heading'] ),
$this->props['content']
);
}
}

new SIMP_SimpleHeader;

The properties that were added to the field are only the required properties you need to define. But you can add more properties to use on the custom field if you want. For instance, you can add both responsive and hover options for your custom field as well.
Divi Builder and Frontend Output
Our field definition is ready. We just need to update the render() method so that it will display the custom field value. Let』s start with the render() method on the module PHP class.
Open the SimpleHeader.php file and update the render() method as follows:

The final code should look like this:
class SIMP_SimpleHeader extends ET_Builder_Module {

public $slug = 'simp_simple_header';
public $vb_support = 'on';

public function init() {
$this->name = esc_html__( 'Simple Header', 'simp-simple-extension' );
}

public function get_fields() {
return array(
'heading' => array(
'label' => esc_html__( 'Heading', 'simp-simple-extension' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => esc_html__( 'Input your desired heading here.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
'content' => array(
'label' => esc_html__( 'Content', 'simp-simple-extension' ),
'type' => 'tiny_mce',
'option_category' => 'basic_option',
'description' => esc_html__( 'Content entered here will appear below the heading text.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
'field' => array(
'label' => esc_html__( 'Custom Field', 'simp-simple-extension' ),
'type' => 'simp_simple_input',
'option_category' => 'basic_option',
'description' => esc_html__( 'Text entered here will appear inside the module.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
),
);
}

public function render( $unprocessed_props, $content = null, $render_slug ) {
return sprintf(
'

%1$s

%2$s

%3$s

',
esc_html( $this->props['heading'] ),
$this->props['content'],
$this->props['field']
);
}
}

new SIMP_SimpleHeader;

Now, let』s edit the render() method of the React component and make it produce the same output that we defined in our PHP render() method.
Open the SimpleHeader.jsx file and update the render() method as follows:

The final code should look like this:
// External Dependencies
import React, { Component, Fragment } from 'react';

// Internal Dependencies
import './style.css';

class SimpleHeader extends Component {

static slug = 'simp_simple_header';

render() {
return (

{this.props.heading}

{this.props.content()}

{this.props.field}

);
}
}

export default SimpleHeader;

Here you can see how the output of the render() method of the php file corresponds to the output of the render() method of the php file which now includes the new field wrapped in a p tag.

Add Selectors if Needed
Wrapping the new field output with a p tag makes sense here because we are interested in simple text output. This also is a good opportunity to add your own custom selectors (CSS ID, CSS Class) to the p tag for your own needs. Just make sure you add the same selectors to the output of the render() method of the PHP file and the JSX file.
Testing Your Custom Fields
If you already have yarn start running as we suggested in the first step, you can now launch the Divi Builder and check out your Simple Input field!
If not, before we can test our custom field in the Divi Builder we need to compile the JSX code into regular JavaScript. To do that, simply run the following command inside your plugin』s directory:
yarn start
As a reminder, you should keep yarn start running as you continue to edit your files so that the files continue to compile successfully.
To test out the custom field, go to your Divi site and open the settings of the custom Simple Header Module. The new Custom Field will be under the content tab.

Wrapping up
When you are finished development, remember to stop yarn start from running in your terminal (hitting ctrl + c within the terminal usually does the trick).

Defining Custom CSS Fields For Modules

Defining Custom CSS Fields For Modules

Defining Custom CSS Fields For Modules
Learn how to define custom CSS fields for modules.

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
Custom CSS fields appear in the Advanced tab of the module settings modal and allow users to set custom CSS properties for predefined target elements within the module』s HTML output. The fields are automatically generated based on the configuration defined in the module』s get_custom_css_fields_config() method.
Custom CSS Fields Configuration

element_one (array)

label (string) — Display name for the target element (localized)
selector (string) — CSS selector for the target element
no_space_before_selector (bool) — Don』t put a space before selector

element_two (array)

label (string) — Display name for the target element (localized)
selector (string) — CSS selector for the target element
no_space_before_selector (bool) — Don』t put a space before selector

Custom CSS Fields Configuration Example

Using Divi』s Blank Page Template

Using Divi』s Blank Page Template

Using Divi』s Blank Page Template
Use the Blank Page template to create unique stand-alone landing pages.

Enabling The Blank Page Template
The blank page template disabled your header and footer and a specific page, leaving only what is built with the builder visible. This is a great way to create unique landing pages that are separate from the rest of your website. For example, you might create a sales landing page, a coming soon page, a newsletter optin page, or a maintenance mode page.When you create a new page, you will notice a settings box on the side of your screen called 「Page Attributes.」 Within this box, look for the 「Template」 option, and from the dropdown menu, select the 「Blank Page」 template.

Once you update your page, you will see that your header and footer has been removed. This gives you a blank canvas on your individual page that you can use to create truly unique designs. Check out this sleek landing page:

How about a coming soon page complete with a countdown timer and an optin box? There are so many possibilities!

How To Install Your Divi Builder WordPress Plugin

How To Install Your Divi Builder WordPress Plugin

How To Install Your Divi Builder WordPress Plugin
Installing our plugins is a snap using the WordPress Dashboard plugin installer.

Download Your Plugin

To update your new plugin, you must first upload it to your WordPress website via the WordPress dashboard. When you download the Divi Builder from the Elegant Themes Member』s Area, you will be be given a file called divi-builder.zip. Some browsers (such as Safari on OSX) will automatically unzip that folder for you. In this case, you will need to re-size the divi-builder folder by right clicking the folder and compressing it. Once you have located your divi-builder.zip file, you are read to upload it to your WordPress website.
Log in to your WordPress Dashboard and click the Plugins > Add New link. This will bring you to the WordPress plugins page.
Upload Your Plugin

After the plugins page in your dashboard has loaded, locate the 「Upload Plugin」 button towards the top of the screen. Click this button to proceed to the next step.
Choose Your Plugin ZIP File

After clicking 「Upload Plugin,」 you will be taken to a new page where you can select the plugin that you would like to install. In this case, we will be installing the divi-builder.zip file that you downloaded earlier. Click the 「Choose File」 button to open a local browser window.
Upload And Activate

You will need to browse your local machine and find the divi-builder.zip file. You will often find it in your Downloads folder, but it depends on your browser settings. Once you have located the file, select it and click the Open button. Next click the 「Install」 button to install the divi-builder.zip folder that you have just selected. After the plugin has been uploaded you will be taken to a confirmation page where you can activate the plugin. Click the 「activate」 button and you are good to go!

Defining Module Settings

Defining Module Settings

Defining Module Settings
Learn how to define module settings using the field types provided by Divi.

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
Module settings are defined in the get_fields() method of the module』s PHP class. A setting definition is simply an associative array of parameters.
Required Parameters

type (string) — The field type used to render the setting in the module settings modal

Optional Parameters

default (string) — Default value
description (string) — Description (localized)
id (string) — CSS id for the setting』s field
label (string) — Display name (localized)
option_category (string) — Option category slug (for the Divi Role Editor)
show_if (array) — Only show the setting when certain settings have certain values
show_if_not (array) — Only show the setting when certain settings do not have certain values
tab_slug (string) — Modal tab slug
toggle_slug (string) — Modal tab settings group toggle slug

Field Types
The Divi Builder has a comprehensive selection of field types for module settings. Below you』ll find a list of available field types, each with a screenshot and a list of any additional parameters that must be included in the setting definition. The value to use for the type parameter of the setting definition is in parenthesis next to each field type name.
Text (text)

Select (select)

Select Field Parameters

options (array) — Option slugs mapped to their display names (localized)

Checkboxes (multiple_checkboxes)

Checkboxes Field Parameters

options (array) — Option slugs mapped to their display names (localized)

Toggle Button (yes_no_button)

Toggle Button Field Parameters

options (array)

off (string) — Display name for the 「off」 state (localized)
on (string) — Display name for the 「on」 state (localized)

Range Slider (range)

Range Slider Field Parameters

range_settings (array)

min (string) — Minimum value
max (string) — Maximum value
step (string) — Minimum distance between values when using the slider

validate_unit (bool) — Whether or not to validate unit

The Divi Blog Module

The Divi Blog Module

The Divi Blog Module
How to add, configure and customize the Divi blog module.

With Divi, even blogs are a module, and your 「blog」 can be placed anywhere on your website, and in various formats. You can combine blog and sidebar modules to create classic blog designs. 1 column, 2 column or 3 column blogs can all be built using blog and sidebar modules.

View A Live Demo Of This Module
How To Add A Blog Module To Your Page
Before you can add a blog module to your page, you will first need to jump into the Divi Builder. Once the Divi Theme has been installed on your website, you will notice a Use Divi Builder button above the post editor every time you are building a new page. Clicking this button will enable the Divi Builder, giving you access to all of the Divi Builder』s modules. Next, click the Use Visual Builder button to launch the builder in Visual Mode. You can also click the Use Visual Builder button when browsing your website on the front end if you are logged in to your WordPress Dashboard.

Once you have entered the Visual Builder, you can click the gray plus button to add a new module to your page. New modules can only be added inside of Rows. If you are starting a new page, don』t forget to add a row to your page first. We have some great tutorials about how to use Divi』s row and section elements.

Locate the blog module within the list of modules and click it to add it to your page. The module list is searchable, which means you can also type the word 「blog」 and then click enter to automatically find and add the blog module! Once the module has been added, you will be greeted with the module』s list of options. These options are separated into three main groups: Content, Design and Advanced.
Use Case Example: Adding Blog Module with A Grid Layout in a Specialty Section with a Right Sidebar
For this example, I』m going to add a Blog Module to a blog page. This blog page has a fullwidth header with a search module below it. Under the Search Module, I』m going to add a specialty section with the Blog Module on the left side and a sidebar section on the right. The sidebar on the right has a recent posts widget, an Email Optin Module, and a Person Module.
Here is what the example page looks like.

Notice the blog module is in a grid layout on the left side of the specialty section.
Let』s get started.
Use the visual builder to add a Specialty Section with the following layout:

You』ll be prompted to add either a 1 column or 2 column row for the left side. Choose the 1 column row.

Then add the Blog Module to the row.

Update the Blog Settings as follows:
Content Options
Posts Number: 6
Read More Button: ON
Show Pagination: NO
Grid Tile Background Color: #ffffff
Design Options
Layout: Grid
Use Dropshadow: ON
Overlay Icon Color: #ffffff
Hover Overlay Color: rgba(224,153,0,0.51)
Header Font: Default
Header Font Size: 21px
Header Text Color: #333333
Header Letter Spacing: 1px
Header Line Height: 1.2em
Use Border: YES
Border Color: #f0f0f0
Border Width: 1px
Border Style: Solid
Advanced Options
Custom CSS (Read More Button):
color: #e09900;
display: block;
text-align:center;
margin-top: 10px;
border: 1px solid #ccc;
padding: 5px;
text-transform: capitalize;
letter-spacing: 1px;

The advanced Custom CSS for the read more button creates a custom look that fits the design well.

On the right sidebar section of the Specialty Section layout you will need to add a sidebar module which pulls in the recent posts widget. Below that you will need to add an Email Optin Module. And then below the Email Optin you need to add the Person Module with info about the author.
That』s it!
Blog Content Options
Within the content tab you will find all of the module』s content elements, such as text, images and icons. Anything that controls what appears in your module will always be found within this tab.

Posts Number
Define the number posts that you wish to display. You will need to have posts made for anything to show up inside of this module.
Select the categories that you would like to include in the post feed. Any post categories that you have created will show up here for you to select/deselect.
Included Categories
Choose which categories you would like to include in the feed.
Meta Date Format
Define the date format that you would like to display on your blog posts here. The default layout is a M j, Y formate (January 6, 2014) See the WordPress Codex on date formats for more options.
Content
Showing the full content will not truncate your posts on the index page. Showing the excerpt will only display your excerpt text.
Offset Number
Choose how many posts you would like to offset by. If you offset by 3 posts, for example, the first three posts in your blog feed will not be displayed.
Show Featured Image
This option allows you to choose whether or not you would like thumbnail images to appear in your blog module.
Read More Button
Here you can define whether to show 「read more」 link after the excerpt or not.
Show Author
Choose whether or not you would like to display the author of each blog post within the post meta area below the post title.
Show Date
Choose whether or not you would like to display the date on which each post was created within the post meta area below the post title.
Show Categories
Choose whether or not you would like to display post categories within the post meta area below the post title.
Show Comment Count
Choose whether or not you would like to display comment count within the post meta area below the post title.
Show Pagination
Choose whether or not you would like to display pagination for this feed. To enable numbered pagination, you will need to install the WP Page Navi plugin.
Admin Label
This will change the label of the module in the builder for easy identification. When using WireFrame view in the Visual Builder, these labels will appear within the module block in the Divi Builder interface.
Blog Design Options
Within the design tab you will find all of the module』s styling options, such as fonts, colors, sizing and spacing. This is the tab you will use to change how your module looks. Every Divi module has a long list of design settings that you can use to change just about anything.

Layout
You can either choose to display your blog posts in a grid or a full width layout.
Featured Image Overlay
If enabled, an overlay color and icon will be displayed when a visitors hovers over the featured image of a post.
Overlay Icon Color
Here you can define a custom color for the overlay icon.
Hover Overlay Color
Here you can define a custom color for the overlay.
Hover Icon Picker
Here you can define a custom icon for the overlay.
Text Color
If your blog is being placed onto a light background the Text Color should be set to 『Dark』. Visa versa, if your blog is being placed onto a dark background, the Text Color should be set to 『Light』.
Header Font
You can change the font of your header text by selecting your desired font from the dropdown menu. Divi comes with dozens of great fonts powered by Google Fonts. By default, Divi uses the Open Sans font for all text on your page. You can also customize the style of your text using the bold, italic, all-caps and underline options.
Header Font Size
Here you can adjust the size of your header text. You can drag the range slider to increase or decrease the size of your text, or you can input your desired text size value directly into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Header Text Color
By default, all text colors in Divi will appear as white or dark gray. If you would like to change the color of your header text, choose your desired color from the color picker using this option.
Header Letter Spacing
Letter spacing affects the space between each letter. If you would like to increase the space between each letter in your header text, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Header Line Height
Line height affects the space between each line of your header text If you would like to increase the space between each line, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Body Font
You can change the font of your body text by selecting your desired font from the dropdown menu. Divi comes with dozens of great fonts powered by Google Fonts. By default, Divi uses the Open Sans font for all text on your page. You can also customize the style of your text using the bold, italic, all-caps and underline options.
Body Font Size
Here you can adjust the size of your body text. You can drag the range slider to increase or decrease the size of your text, or you can input your desired text size value directly into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Body Text Color
By default, all text colors in Divi will appear as white or dark gray. If you would like to change the color of your body text, choose your desired color from the color picker using this option.
Body Letter Spacing
Letter spacing affects the space between each letter. If you would like to increase the space between each letter in your body text, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Body Line Height
Line height affects the space between each line of your body text If you would like to increase the space between each line, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Meta Font
You can change the font of your meta text by selecting your desired font from the dropdown menu. Divi comes with dozens of great fonts powered by Google Fonts. By default, Divi uses the Open Sans font for all text on your page. You can also customize the style of your text using the bold, italic, all-caps and underline options.
Meta Font Size
Here you can adjust the size of your meta text. You can drag the range slider to increase or decrease the size of your text, or you can input your desired text size value directly into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Meta Text Color
By default, all text colors in Divi will appear as white or dark gray. If you would like to change the color of your meta text, choose your desired color from the color picker using this option.
Meta Letter Spacing
Letter spacing affects the space between each letter. If you would like to increase the space between each letter in your meta text, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Meta Line Height
Line height affects the space between each line of your meta text If you would like to increase the space between each line, use the range slider to adjust the space or input your desired spacing size into the input field to the right of the slider. The input fields supports different units of measurement, which means you can input 「px」 or 「em」 following your size value to change its unit type.
Use Border
Enabling this option will place a border around your module. This border can be customized using the following conditional settings.
Border Color
This option affects the color of your border. Select a custom color from the color picker to apply it to your border.
Border Width
By default, borders have a width of 1 pixel. You can increase this value by dragging the range slider or by inputting a custom value into the input field to the right of the slider. Custom units of measurements of supported, which means you can change the default unit from 「px」 to something else, such as em, vh, vw etc.
Border Style
Borders support eight different styles, including: solid, dotted, dashed, double, groove, ridge, inset and outset. Select your desired style from the dropdown menu to apply it to your border.
Blog Advanced Options
Within the advanced tab, you will find options that more experienced web designers might find useful, such as custom CSS and HTML attributes. Here you can apply custom CSS to any of the module』s many elements. You can also apply custom CSS classes and IDs to the module, which can be used to customize the module within your child theme』s style.css file.

CSS ID
Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.
CSS Class
Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space. These classes can be used in your Divi Child Theme or within the Custom CSS that you add to your page or your website using the Divi Theme Options or Divi Builder Page Settings.
Custom CSS
Custom CSS can also be applied to the module and any of the module』s internal elements. Within the Custom CSS section, you will find a text field where you can add custom CSS directly to each element. CSS input into these settings are already wrapped within style tags, so you need only enter CSS rules separated by semicolons.
Visibility
This option lets you control which devices your module appears on. You can choose to disable your module on tablets, smart phones or desktop computers individually. This is useful if you want to use different modules on different devices, or if you want to simplify the mobile design by eliminating certain elements from the page.

Divi Builder Hooks

Divi Builder Hooks

Divi Builder Hooks
Learn about the hooks that are available in Divi Builder features.

Conditional Display
et_module_process_display_conditions
Filters every rendered module output for processing 「Display Conditions」 option group.
Type: Filter
Since: 4.13.1

Param
Type
Description

$output
string
HTML output of the rendered module.

$render_method
string
The render method used to render the module.

$this
ET_Builder_Element
The current instance of ET_Builder_Element.

et_is_display_conditions_option_visible
Filters 「Display Conditions」 option visibility to determine whether to add its field to the Visual Builder or not. Useful for displaying/hiding the option on the Visual Builder.
Type: Filter
Since: 4.13.1

Param
Type
Description

$default_status
boolean
True to make the option visible on VB, False to make it hidden.

et_is_display_conditions_functionality_enabled
Filters 「Display Conditions」 functionality to determine whether to enable or disable the functionality or not. Useful for disabling/enabling 「Display Condition」 feature site-wide.
Type: Filter
Since: 4.13.1

Param
Type
Description

$default_status
boolean
True to enable the functionality, False to disable it.

How To Update Your Divi Builder WordPress Plugin

How To Update Your Divi Builder WordPress Plugin

How To Update Your Divi Builder WordPress Plugin
Using our Elegant Updater Plugin, you can update the Divi Builder right from your dashboard.

Updating Your Themes & Plugins
Before you can update, you must first authenticate your Elegant Themes subscription by inputting your Username and API Key into the Updates tab of your theme or plugin settings. Only members with active Elegant Themes accounts have access to the latest versions of our products. Your Username is the username you use when logging in to ElegantThemes.com, and your API Key can be found by logging into your Elegant Themes account and clicking on the Account > Your API Key link. Once you have authenticated your account, you can click the update link when you receive an update notification to automatically update your theme or plugin
Update Notifications
When new updates become available for any of our themes or plugins, a notification will appear in the Dashboard > Updates page of your website』s WordPress Dashboard.

Authenticating Your Membership
Before you can update your theme or plugin, you must first authenticate your Elegant Themes subscription. Only members with active accounts have access to product updates. To authenticate your account, you will be asked to input two pieces of information into your theme or plugin settings panel: 1) Your Username and 2) Your API Key. Your username is the same username you use when logging in to your ElegantThemes.com account, and your API Key is a unique identifier used to authenticate your account that is only available to you when logging in. To locate your API Key, log in to the Elegant Themes members area and click on the Account > Your API Key link. Copy the API Key displayed on the page. You will by pasting this key into your Theme or Plugin options page.

Once you have copied your API Key, you will need to use it to authenticate your account by pasting it into your theme or plugin options page. Log in to your website』s WordPress Dashboard and navigate to your theme or plugin options page. For Divi, this can be found by clicking the Divi > Plugin Options link.

Once you have loaded your theme or plugin options page, look for the Updates tab. Click the Updates tab to reveal the Username and API Key fields. Type your username into the Username field and paste the API Key you copied earlier into the API Key field. You should confirm that you have not copied any extra white spaces by mistake. Click save to complete the account authorization.

Once you have entered your credentials, you are now ready to update your plugin. Click on the Dashboard > Updates tab and update your theme or plugin normally using the WordPress update interface. If you do not see any update notifications, or you receive an authentication error when updating, try waiting a bit and then check back later. Sometimes WordPress will cache update notifications and it can take some time for them to appear correctly.

How To Create A Divi Builder Module

How To Create A Divi Builder Module

How To Create A Divi Builder Module
Learn how to create a custom module for the Divi Builder.

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
Custom Divi Builder Modules
Divi Builder modules consist of PHP, JavaScript, HTML, & CSS code. Each module is defined using a PHP class. The class defines all of the module』s settings and is responsible for rendering the module』s HTML output on the frontend. Additionally, each module has a ReactJS component class (in JavaScript) that handles rendering the module inside of the Divi Builder. In this tutorial, you』ll learn how to create a custom header module. The module will be fully functional in the builder, both on the frontend and on the backend.
Custom Divi Builder modules must be implemented within a theme, child-theme, or Divi Extension. In this tutorial we』re going to implement a custom module in a Divi Extension. If you haven』t already done so, go ahead and create a Divi Extension.
Module Definition
Divi Builder modules are defined using a PHP class. Look inside your extension』s directory and find the example module located in includes/modules. We』ll use it as a starting point to create a custom header module. First, let』s rename the HelloWorld directory to SimpleHeader. Next, rename HelloWorld.php to SimpleHeader.php, open it, and then edit it as shown below:

name = esc_html__( 'Simple Header', 'simp-simple-extension' );

}

public function get_fields() {

return array();

}

public function render( $unprocessed_props, $content = null, $render_slug ) {

}

}

new SIMP_SimpleHeader;

view raw

SimpleHeader.php

hosted with by GitHub

Our module will include just a few basic settings that can be controlled from within the Divi Builder: heading, content, and background. Module settings are defined in the get_fields() method. Let』s go ahead and do that now:

name = esc_html__( 'Simple Header', 'simp-simple-extension' );

}

public function get_fields() {

return array(

'heading' => array(

'label' => esc_html__( 'Heading', 'simp-simple-extension' ),

'type' => 'text',

'option_category' => 'basic_option',

'description' => esc_html__( 'Input your desired heading here.', 'simp-simple-extension' ),

'toggle_slug' => 'main_content',

),

'content' => array(

'label' => esc_html__( 'Content', 'simp-simple-extension' ),

'type' => 'tiny_mce',

'option_category' => 'basic_option',

'description' => esc_html__( 'Content entered here will appear below the heading text.', 'simp-simple-extension' ),

'toggle_slug' => 'main_content',

),

);

}

public function render( $unprocessed_props, $content = null, $render_slug ) {

}

}

new SIMP_SimpleHeader;

view raw

SimpleHeader.php

hosted with by GitHub

You probably noticed that the background field is missing. We excluded it from the fields array because it』s one of several advanced fields that are added automatically by the builder to all modules unless they specifically opt-out. You』ll learn more about advanced fields a bit later in this tutorial series.
Our module definition is almost complete. We just need to finish the implementation of the render() method so that it will generate the module』s HTML output based on its props. Ready? Let』s do it!

name = esc_html__( 'Simple Header', 'simp-simple-extension' );

}

public function get_fields() {

return array(

'heading' => array(

'label' => esc_html__( 'Heading', 'simp-simple-extension' ),

'type' => 'text',

'option_category' => 'basic_option',

'description' => esc_html__( 'Input your desired heading here.', 'simp-simple-extension' ),

'toggle_slug' => 'main_content',

),

'content' => array(

'label' => esc_html__( 'Content', 'simp-simple-extension' ),

'type' => 'tiny_mce',

'option_category' => 'basic_option',

'description' => esc_html__( 'Content entered here will appear below the heading text.', 'simp-simple-extension' ),

'toggle_slug' => 'main_content',

),

);

}

public function render( $unprocessed_props, $content = null, $render_slug ) {

return sprintf(

'

%1$s

%2$s

',

esc_html( $this->props['heading'] ),

$this->props['content']

);

}

}

new SIMP_SimpleHeader;

view raw

SimpleHeader.php

hosted with by GitHub

React Component
In order for our module to be available and fully functional inside the Divi Builder we must create a React Component class that handles the rendering of our module based on its props. Look in your module』s directory for the file named HelloWorld.jsx.
Note: JSX is a syntax extension to JavaScript used in React to describe what the UI should look like.
Let』s rename HelloWorld.jsx to SimpleHeader.jsx, open it, and then edit it as follows:

// External Dependencies

import React, { Component, Fragment } from 'react';

// Internal Dependencies

import './style.css';

class SimpleHeader extends Component {

static slug = 'simp_simple_header';

render() {

return (

{this.props.content()}

);

}

}

export default SimpleHeader;

view raw

SimpleHeader.jsx

hosted with by GitHub

Next, let』s update the import and export statements in includes/modules/index.js:

// Internal Dependencies

import SimpleHeader from './SimpleHeader/SimpleHeader';

export default [

SimpleHeader,

];

view raw

index.js

hosted with by GitHub

Now, let』s edit the render() method and make it produce the same output that we defined in our PHP render() method.

// External Dependencies

import React, { Component, Fragment } from 'react';

// Internal Dependencies

import './style.css';

class SimpleHeader extends Component {

static slug = 'simp_simple_header';

render() {

return (

{this.props.heading}

{this.props.content()}

);

}

}

export default SimpleHeader;

view raw

SimpleHeader.jsx

hosted with by GitHub

There are two things in our render() method to take note of. First, note how the module』s content setting is handled. Module settings defined with field type tiny_mce (like the content setting in our module) require the use of a special React Component. The builder sets up the required component and then passes it down to the module as the setting value. Since the value is not a string or number and is actually a React Component, we need to use it as such in our JSX markup.
Also note how we wrapped our module』s output in a Fragment component. Fragments allow you to return multiple top-level elements from your render() method without actually adding an extra element to the page itself.
CSS Styles
Styles for our module can be defined using the style.css file in its directory. Our custom header module is pretty basic so it doesn』t require much styling. Though we should add some bottom margin for the heading so that there is some space between it and the content below it. Later, in our Divi Builder Module In-Depth tutorial series you』ll learn how to make margin and padding for the heading (or any element inside your module』s output) configurable from within the module』s settings.
For now, let』s go ahead and update our module』s style.css:

.simp-simple-header-heading {

margin-bottom: 20px;

}

view raw

style.css

hosted with by GitHub

Testing During Development
Before we can test our custom module in the Divi Builder we need to compile the JSX code into regular JavaScript. To do that, simply run the following command inside your plugin』s directory:
yarn start

Provided there are no syntax errors in your code you will see the following output:

Now you can launch the Divi Builder and check out your Simple Header module!
 
Note: You must keep the terminal window with yarn start running open while you are developing your module. As you make changes to the files, the JavaScript and CSS will be recompiled automatically.

Divi Development Environment Setup

Divi Development Environment Setup

Divi Development Environment Setup
Learn how to get a local development environment up and running.

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.
Before you can create Divi Extensions 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 gettext (needed to process translations when creating releases)
The latest version of Divi

There are several different options you can use to get a local development environment up and running. A few examples are:

Docker
Vagrant
Local by Flywheel
XAMPP

In this tutorial we』ll be using Docker with the official docker image for Divi Development.
Install Docker
The most complicated part of installing docker is figuring out which version you need to install. Use the following tables to locate the correct version for your operating system and then download and run the installer for that version.
Mac

OS Version
Installer
Detailed Instructions
Complete Documentation

OS X 10.11+
Docker for Mac
Instructions
Documentation

OS X 10.8-10.10
Docker Toolbox
Instructions
Documentation

Windows

OS Version
Installer
Detailed Instructions
Complete Documentation

10 Pro+
Docker for Windows
Instructions
Documentation

10 Home
Docker Toolbox
Instructions
Documentation

Linux

OS Version
Detailed Instructions

Ubuntu 16.04+
Instructions

Fedora 25+
Instructions

Using Linux? Follow the instructions linked in the table as there is no Docker installer for Linux.
Start Docker Containers
The Divi Development Environment consists of two docker containers, one for the database and one for everything else. Starting/Stopping multiple containers for a single environment can be tedious. Luckily, we won』t have to worry about that because we』re going to use the docker-compose command.
Docker Compose is a tool for defining and running multi-container Docker applications.
Go ahead and create a new directory for your development workspace. The directory should be located somewhere below one of the following paths (depending on your OS):
Default Shared Directories
Mac: /Users, /Volumes, /private, & /tmp
Windows: C:Users
Linux: /home
Now, create a file named docker-compose.yml inside your workspace directory as shown below:

version: '3.3'

services:

mariadb:

image: 'mariadb:10.2.14'

environment:

MYSQL_ROOT_PASSWORD: password

MYSQL_DATABASE: wordpress

DATADIR: /data

restart: on-failure

volumes:

- 'database:/data'

network_mode: 'service:wordpress'

wordpress:

image: 'elegantthemes/divi-dev'

hostname: divi-dev

volumes:

- '${PWD}:/workspace/wordpress'

ports:

- '80:80' # nginx

- '3306:3306' # mariadb

- '3000:3000' # webpack hmr

volumes:

database: {}

view raw

docker-compose.yml

hosted with by GitHub

Using Windows? You need to replace ${PWD} in the compose file with the full path to the directory where the compose file is located.
Run WordPress Container Setup Script
Open a terminal window in your workspace directory and run the following commands:
docker-compose up -d
docker-compose exec -u 1000 wordpress divi-dev setup
This could take a few minutes (or more) depending on your internet connection speed. When it』s done you should see the following:
Creating network "divi-dev_default" with the default driver
Creating divi-dev_wordpress_1 ... done
Creating divi-dev_mariadb_1 ... done
Downloading WordPress 4.9.5 (en_US)...
md5 hash verified: f009061b9d24854bfdc999c7fbeb7579
Success: WordPress downloaded.
Initializing database... ████████████████████| 100%
Success: Generated 'wp-config.php' file.
Success: WordPress installed successfully.
Success: Rewrite rules flushed.
Success: Rewrite structure set.

Setup Complete! Here's how you can access WordPress:

URL: http://local.divi-dev.site
Username: divi-dev
Password: password

Final Step: Access WordPress Dashboard And Install Divi
Divi isn』t included in the container. The final step is to install it via the WordPress Dashboard.
Commands Quick Reference
You can use the following commands to manage your containers. Be sure to run them from inside your workspace directory:
Enter Container (get command prompt inside container)
docker-compose exec -u 1000 wordpress /bin/bash
Exit Container (return to your system』s command prompt)
exit
Stop Running Containers
docker-compose stop
Start Stopped Containers
docker-compose start
Remove Containers (WordPress database will be deleted!)
docker-compose down
Start New Containers
docker-compose up -d
docker-compose exec -u 1000 wordpress divi-dev setup