Skip to content

Instantly share code, notes, and snippets.

@amElnagdy
Created January 7, 2017 23:47
Show Gist options
  • Save amElnagdy/2796ac11856bb97ed7b705d3bb287778 to your computer and use it in GitHub Desktop.
Save amElnagdy/2796ac11856bb97ed7b705d3bb287778 to your computer and use it in GitHub Desktop.
<?php
// Divi Builder on custom post types by https://wpcolt.com
add_filter('et_builder_post_types', 'divicolt_post_types');
add_filter('et_fb_post_types','divicolt_post_types' ); // Enable Divi Visual Builder on the custom post types
function divicolt_post_types($post_types)
{
foreach (get_post_types() as $post_type) {
if (!in_array($post_type, $post_types) and post_type_supports($post_type, 'editor')) {
$post_types[] = $post_type;
}
}
return $post_types;
}
add_action('add_meta_boxes', 'divicolt_add_meta_box');
function divicolt_add_meta_box()
{
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'editor') and function_exists('et_single_settings_meta_box')) {
$obj= get_post_type_object( $post_type );
add_meta_box('et_settings_meta_box', sprintf(__('Divi %s Settings', 'Divi'), $obj->labels->singular_name), 'et_single_settings_meta_box', $post_type, 'side', 'high');
}
}
}
add_action('admin_head', 'divicolt_admin_js');
function divicolt_admin_js()
{
$s = get_current_screen();
if (!empty($s->post_type) and $s->post_type != 'page' and $s->post_type != 'post') {
?>
<script>
jQuery(function ($) {
$('#et_pb_layout').insertAfter($('#et_pb_main_editor_wrap'));
});
</script>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment