I doubt I need to convince anyone reading this that the Divi Builder is a powerful tool. It takes the heavy lifting out of creating new posts and pages and lets us reach our design potential before hitting our technical limitations, and that’s great! But every now and then you may install a plugin or third party software that adds a post type that doesn’t support the use of the Divi Builder by default. There are workarounds of course: Elegant Themes posted a great blog about how to add the Divi Builder to custom post types, and until recently, this was my own method for doing so. It works great but if you’re regularly adding plugins for testing, or have lots of CPT’s already and don’t want to go through finding the names of them all, then this method can be laborious.
However, it does give us a good base for a slightly different method. The following function doesn’t require you to know the name of your custom post types and it doesn’t even require you to update it if you add/remove plugins that load custom post types. Instead, what it does is get a list of all CPT’s currently being loaded on a site and then adds ET’s method to each of them automatically. So essentially, if you add this into your functions.php file, you can forget about the fact that CPT’s don’t have the Divi Builder option, because now they do.
<?php function dpb_all_post_types( $post_types ) { $post_types = get_post_types(); if ( $post_types ) { // If there are any custom public post types. foreach ( $post_types as $post_type ) { $post_types[] ='$post_type'; return $post_types; } } } add_filter( 'et_builder_post_types', 'dpb_all_post_types' ); ?>
Pretty cool, right?
I would like to exclude DIVI builder from Learndash. How can I do this?
I don’t like that DIVI is buggy in learndash.
It would be best to contact Learndash directly regarding this
Spectacularly minimalistic solution. TY!
Beautiful! love love love this so much. Thanks SJ
Thanks this helped a lot
This works but when you try to load a lay out from your library the layouts do not show. Help please?
Sean has a solution for Library items:
add_filter( ‘et_pb_show_all_layouts_built_for_post_type’, ‘sb_et_pb_show_all_layouts_built_for_post_type’ );
function sb_et_pb_show_all_layouts_built_for_post_type() {
return ‘page’;
}
If anyone wants to have access to the page layout/sidebar settings in the Divi Custom Post Settings box after choosing to use the Divi builder and with content on the page, just right-click and inspect the element in your browser.
In ‘et_settings_meta_box’ you will see another div with the class of ‘inside’. In that you’ll see a paragraph whose class is ‘et_pb_side_nav_settings’. Just delete ‘style=”display: none;”‘ in your browser editor and the option to choose sidebars or a full page will then become available to use.
I don’t know why Divi decided to hide this option but it works as it should when you remove that code. Hope that helps.
Yes. This was really timely as I had this exact situation and this arrived in my inbox. Thank you!!!
Nice one, SJ.
I’ve been doing something similar for a while:
https://divibooster.com/enable-divi-builder-on-custom-post-types/
The first function is pretty much the same as yours – I added a check that the CPT supports the WordPress editor box (as the builder won’t work without it), but I don’t think it’s essential.
The other functions add a few useful enhancements, such as solving compatibility issues that can arise with certain CPTs.
Works great!
Thanks! 😀
Any suggestions on how to add the full width option on these CPT ?
Thanks again!
Hi Stephen, does it implement Divi in left pane like the tutorial by ET or does your code implement Divi in full so I can for example use full width slider and it will actually be full width? Thanks.
Oh wow, there I was yesterday looking to solve this exact problem with CPTUI, and now have a much simpler way. Thank you so much.
Thanks!
I quess then it’s only me that removes the builder from “pages”. It works though with cpt. Also any way to take back side bar functionality?
This is great! However, do you know how to get the “Divi Page Settings” on the right sidebar to show up on the CPTs so that we can change the “Page Layout” to “full width” and use other functions in the Divi Page Settings? Thank you very much!
Beautiful! Thanks so much! 😀
Hi, James, I tried this but it seems to remove the divi builder rather than add the builder. What could I be doing wrong? I pasted it into the functions.php and the site works fine.
Hey, yeah I overlooked an issue with inbuilt post types. The code has been updated 🙂
Great tutorial! Thanks a lot.