Giter Site home page Giter Site logo

rm2334 / divi3-vb-custom-modules Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stracker-phil/divi3-vb-custom-modules

1.0 1.0 0.0 70 KB

Upgrade your Divi 3 theme to enable custom modules in the Visual Builder (=front end editing)

PHP 61.16% JavaScript 38.84%

divi3-vb-custom-modules's Introduction

Example

Info

This info shows you, how to modify your Divi3 theme to enable custom built modules in the visual builder (= in front-end editing)

Note that after this change your custom modules will show in the visual builder, but need to be modified in order to display the actual preview! Out of the box, this modification will display a block with the text "No Preview Available" for every custom module you insert. However, you can still change the settings of the module and save the page to see the results on the saved page.

Video Guide

Watch how I modify Divi 3.0.18 in less then 2 minutes!

https://youtu.be/rvhHuqKMCHQ

Step 1

You need to open the file Divi/includes/builder/frontend-builder/bundle.js in a text editor. You will change this file.

Step 2

Before you can edit that file you need to prettify it (i.e. make it a bit more readable). For this I use the Google Chrome browser: Simply drag the file into the browser and use the built in dev-tools to create the prettified code.

Paste the prettified code back to bundle.js and save. Quickly test your website to ensure Divi is still working.

Step 3

Find the highest module ID (you don't need to know what I mean, just do it)

Past this code right BEFORE the return near line 16

alert('Next ID:' + arguments[0].length)

And refresh your website once again to see the javascript alert result. In Divi 3.0.32 the result is '747'

Step 4

Modify the code in snippet1.js (you need to insert the module ID you found in one place)

Then find the correct spot in the bundle.js file. Very easy: Search for the term "video-slider-item": - it only appears once in the whole file. Scroll down to the end of the function and paste the snippet.js code there.

Step 5

The last bit was difficult for me to create - but it is very simple for you :)

Paste the contents of snippet2.js at the end of the file, right before the final ])); line.

Step 6

Save and you're done! :)

Reload your website and test Divi. It will show your custom modules.

Demo module

The file demo-module.php is a simple WordPress plugin that adds 2 Divi modules (both with title "Testimonial") that illustrate the change for you.

  • The first module has the modification that I mentioned in the Introduction to make the preview work in visual builder.
  • The second module does not have this modification and you will see how a normal module will look like. Note that it still works, but only the preview in visual builder is missing. This is how all the custom modules from Divi 2.x will look like, until the author updates them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.