Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.