This write-down will help you understand how to connect the Divi Builder Plugin to OceanWP library and use it on your website if you need it for some reason like I was. Page Builder Everywhere plugin is not working well with OceanWP singular.php template on posts natively, I was looking for a solution and I found a simple way to do this clearly.

OceanWP > My Library

When you open OceanWP > My Library you can see it’s managed by CPT (Custom Post Type).
/wp-admin/edit.php?post_type=oceanwp_library

Add the Divi Builder AND Divi Library to ANY CPT

Sean Barton published last year very useful code snippet that allows Divi Builder to works on any CPT. Just copy to your functions.php file and it’s done.

//----- Add the Divi Builder AND Divi Library to ANY CPT
function sb_et_builder_post_types( $post_types ) {
    $post_types[] = 'oceanwp_library';
    return $post_types;
}
add_filter( 'et_builder_post_types', 'sb_et_builder_post_types' );
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';
}

source: https://www.sean-barton.co.uk/2017/05/how-to-add-the-divi-builder-and-divi-library-to-any-cpt/

OceanWP > My Library > Donate

For this post as a example I create Library Template “Donate”. I allready have a page Donate created before with Divi Builder and saved to Divi Library. When I was creating OceanWP “Donate” I just use Divi Builder and I click Load from Divi library. See the screenshot bellow.
/?oceanwp_library=donate

Insert Pages

This plugin gives you a possibility to include pages, CPT anywhere on your site through the use of shortcodes.

Output to singular.php

Now we can output shortcode to singular.php like obviously somewhere near the comments section. That’s all.

<?php if ( is_singular( 'post' ) ) {
     echo do_shortcode('[insert page="donate" display="content"]');
     } ?>

Final words:

This is a example how to connect Divi Builder Plugin to OceanWP Library and get this to work. This technique is generally applicable to other builders and CPT when you need it.

David

Graphic and website designer, currently, I attend to the maintenance of about thirty sites for existing clients as well as creating websites for the new ones. In my free time, I get into the secrets of the world of Linux, SSH, WP-CLI and I’m preparing this blog.

More:

Divi 3.1 – The New Divi Developer API Toolbo... Divi 3.1 Has Arrived! Introducing The New Divi Developer API - this update opens up Divi with a new API for developers that makes it easy to create cu...
How to Create and Use Code Snippets in Sublime Tex... When you're writing system code, it won’t work possibly, except that it's written and then saved in a plain text environment. This is where a text edi...
How to Stop Image Hotlinking with .htaccess Stop Image Hotlinking - we have a quick tip, that can help you protect your server bandwidth. So if you are in situation that you find your pictures o...
4Divi – Plugins for Divi Builder 4Divi - Plugins for Divi Builder 4Divi - is a brand new project which serves useful plugins that can expand or add new modules through Divi Builder...
A Complete guideline on creating WordPress themes ... With WordPress ruling the world of Content Management Systems(CMSs), more and more people are switching towards building their websites using this web...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Newsletter

Join our mailing list to receive the latest news and updates.

You have Successfully Subscribed!

Pin It on Pinterest