How To Add Any Divi Module inside another Module Using Shortcodes

July 19, 2020

Comments

How to add modules inside modules?

Hey guys, in this tutorial you will learn how to add any layout within a module using a short code. 

First things first. You will need a child theme for this to stay working even through updates.

Step 1

Now, go to Appearance > Editor and click on function.php

Then, add the following code at the bottom without disturbing any previous code.

// create new column in et_pb_layout screen
add_filter( 'manage_et_pb_layout_posts_columns', 'ds_create_shortcode_column', 5 );
add_action( 'manage_et_pb_layout_posts_custom_column', 'ds_shortcode_content', 5, 2 );
// register new shortcode
add_shortcode('ds_layout_sc', 'ds_shortcode_mod');

// New Admin Column
function ds_create_shortcode_column( $columns ) {
$columns['ds_shortcode_id'] = 'Module Shortcode';
return $columns;
}

//Display Shortcode
function ds_shortcode_content( $column, $id ) {
if( 'ds_shortcode_id' == $column ) {
?>

[ds_layout_sc id=""]

'*'),$ds_mod_id)); return do_shortcode('
[woo_cart_but]
'); }[/et_pb_text]

Here you can see a new column is created with a shirtcode for each layout.  

Step 2

Now you can injuect layouts within layouts by simply copying and pasting the shortcode in which ever module you want.

[/et_pb_column][/et_pb_row][/et_pb_section]

Related Posts

Add WooCommerce Cart Icon to Menu with Cart Item Count

Add WooCommerce Cart Icon to Menu with Cart Item Count

Here is a way to add WooCommerce cart icon to a menu with the cart item count, it links to the cart page and displays the number of items that have been added to the cart. The complete code uses three (3) php functions. This php code must be added to which need to be...

Close Default Open Accordion in Divi

Close Default Open Accordion in Divi

  In accordion module, first accordion is set to be open by default on opening the page. But we can close default open accordion by applying some javascript. To close the default accordion toggle, Go to Divi > Theme Option > Integration And copy the given...

1 Comments

1 Comment

  1. Malatya

    I really like what you guys are up too. This sort of clever work and coverage!

News & Updates

Join Our Newsletter

[caldera_form id=”CF59c8d8a75c5cd”]