Remove Genesis Inpost Layout Box on Posts

Remove Genesis inpost layout box on posts, or any post type, specifically.

<?php
/**
* Don't show layout box on posts, only pages
* @author Joshua David Nelson, [email protected]
*/
add_action( 'init', 'jdn_remove_inpost_layouts' );
function jdn_remove_inpost_layouts() {
// Bail if it's not an admin
if( !is_admin() )
return;
// Method from Ross McCay: http://snippets.webaware.com.au/snippets/wordpress-admin_init-hook-and-the-elusive-typenow/
global $typenow;
// when editing pages, $typenow isn't set until later!
if (empty($typenow)) {
// try to pick it up from the query string
if (!empty($_GET['post'])) {
$post = get_post($_GET['post']);
$typenow = $post->post_type;
}
// try to pick it up from the quick edit AJAX post
elseif (!empty($_POST['post_ID'])) {
$post = get_post($_POST['post_ID']);
$typenow = $post->post_type;
}
}
// Verify we're on the post page
if( !isset( $typenow ) || $typenow != 'post' )
return;
// Remove the inpost layout action
remove_action( 'admin_menu', 'genesis_add_inpost_layout_box' );
}

Source: https://gist.github.com/joshuadavidnelson/abf807f973b86ae144a7

Tags: ,