Created
November 24, 2016 13:19
-
-
Save amElnagdy/ca5d509a4bfc7e527be1857ccce1a554 to your computer and use it in GitHub Desktop.
A simple code to enable Divi settings metabox on custom post types
This file contains hidden or 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
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