Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to create a Custom Post type template that uses a divi layout directly
## first in your functions.php add the following:
//Shortcode to show the module
function showmodule_shortcode($moduleid) {
extract( shortcode_atts( array('id' =>'*'), $moduleid ) );
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
add_shortcode('showmodule', 'showmodule_shortcode');
## then create your single-customCPT.php file duplicating page.php from divi and look for line 45 :
## and replace it for
echo do_shortcode('[showmodule id="YOUR LAYOUT ID"]');
### remember: you need to create your divi layout first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.