I’ve been working on the Divi Cloud project for a month or two now and am optimising the server side of things. A side that no one except me cares about although something that really matters to those who use the service. The server plugin keeps things fast and effective and so it’s rather important. Data entry for us into the Divi United site is laborious at present and so I wanted to do something about this. I won’t go into detail about exactly what it does and doesn’t do (trade secrets and all that) however. I did come across the need to use the Divi Builder on a custom post type (CPT).

This method has been publicised heavily by various bloggers.. some doing it the ‘right way’ and others missing the point entirely… such is the nature of the web! I came across an official Elegant Themes blog post from mid 2016 explaining how to do it and in the comments someone asked why their Divi Library items are not showing in the CPT. The reason given was that CPTs have their own library (sort of) and as such those library items made for posts/pages can therefore not be used for a CPT.. such as projects or products.

So. I did what I always do and went digging around the code. As it turns out I needed the Divi Library to load in layouts and therefore needed to work around this limitation. I found it within a few minutes. Using a simple filter you can make the CPT think that it needs to pull from the post/page library instead of it’s own. This is in no way a perfect solution but seems to be bug/error free and gets your library items to show in the CPT.. or it did for me at least.

So the original code to enable the builder on the post type is as follows:

function sb_et_builder_post_types( $post_types ) {
 $post_types[] = 'your-cpt';
 return $post_types;
add_filter( 'et_builder_post_types', 'sb_et_builder_post_types' );

And the code to make the Divi Library ‘work’ is this:

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';

Add both to your child theme functions.php file and you should instantly see the results!

A donate button!

Be the first to hear about new products/updates!

This is a mailing list for those people interested in being told when we release a new product (Divi plugin or Theme).

We shall also use this list to let you know about product updates and releases.

You have Successfully Subscribed!