Joshua David Nelson

Bullshit Free WordPress Development

  • Services
  • Code
  • About
  • Contact

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' );
}
view raw remove-inpost-layout.php hosted with ❤ by GitHub

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

Tags: Genesis, layout

Previous Code:
Exclude Post Types From Search
Back to the Code Snippets
Next Code:
Add WooCommerce Product Description Below Product
  • Twitter
  • RSS Feed URL

About Me

I'm a WordPress Engineer. I build sleek, custom websites with WordPress and Genesis.

See my services and my recent work.

Contact me to get your project started.

Gravity Forms Plugin for WordPress Fastest WordPress Hosting

Recent Posts

  • Using Font Awesome Icons for WooCommerce Grid / List Toggle
  • Disable Blog: WordPress Gone Blog-less
  • Category (Taxonomy) Dropdown Filtered By Post Type
  • Weather in WordPress with Dark Sky
  • Fixing Your Deprecated Widget Constructors in WordPress 4.3
  • Twitter
  • RSS Feed URL
  • Code Snippets
  • My Plugins
  • Make a Payment

© Joshua David Nelson | Hand-Forged | WordPress + Genesis | Terms of Service | Legal | Contact