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

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk