Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 9, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/2345008 to your computer and use it in GitHub Desktop.
Save billerickson/2345008 to your computer and use it in GitHub Desktop.
Remove Inpost Layout Options
<?php
/**
* Remove Inpost Layout Options
*
* Use if you have hardcoded the layout on certain template pages
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/remove-inpost-layout-options
*/
function be_remove_inpost_layout_options() {
// Get the Post ID
if( isset( $_GET['post'] ) ) $post_id = $_GET['post'];
elseif( isset( $_POST['post_ID'] ) ) $post_id = $_POST['post_ID'];
if( !isset( $post_id ) ) return;
// Get the Page Template
$template_file = get_post_meta( $post_id, '_wp_page_template', true );
$exclude_layout = array( 'template-products.php' );
if ( in_array( $template_file, $exclude_layout ) )
remove_meta_box( 'genesis_inpost_layout_box', 'page', 'normal' );
}
add_action( 'admin_enqueue_scripts', 'be_remove_inpost_layout_options' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment