Created
January 7, 2017 23:47
-
-
Save amElnagdy/2796ac11856bb97ed7b705d3bb287778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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