Skip to content

Instantly share code, notes, and snippets.

@robhob
Last active November 22, 2017 03:15
Show Gist options
  • Save robhob/53ff9c2562902d2f40108f376a992ba8 to your computer and use it in GitHub Desktop.
Save robhob/53ff9c2562902d2f40108f376a992ba8 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Simple Divi Shortcoder
Plugin URI: https://divinotes.com/how-to-build-a-simple-plugin-to-easily-embed-divi-section-module-within-another/
Description: The purpose of this plugin is to allow you to embed Divi sections or modules within other Divi modules or anything else that supports shortcodes.
Version: 1.0
Author: Your Name
Author URI: https://divinotes.com
License: GPL2
Simple Divi Shortcoder is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
Simple Divi Shortcoder is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
//Shortcode to show the section or module
function show_simple_divi_module_shortcode($moduleid) {
extract(shortcode_atts(array('id' =>'*'),$moduleid));
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
add_shortcode('showmodule', 'show_simple_divi_module_shortcode');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment