* @copyright Copyright (c) 2014, Rajeeb Banstola * @link http://rajeebbanstola.com.np * @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html */ /* Sets the path to the layout images directory. */ define( 'inception_ADMIN_IMAGES_URL', get_template_directory_uri() .'/inc/admin/img/' ); add_action( 'add_meta_boxes', 'inception_add_custom_box' ); /** * Add Meta Boxes. * * Add Meta box in page and post post types. */ function inception_add_custom_box() { add_meta_box( 'siderbar-layout', //Unique ID __( 'Select layout for this specific Page only ( Note: This setting only reflects if page Template is set as Default Template.)', 'inception' ), //Title 'inception_sidebar_layout', //Callback function 'page' //show metabox in pages ); add_meta_box( 'siderbar-layout', //Unique ID __( 'Select layout for this specific Post only', 'inception' ), //Title 'inception_sidebar_layout', //Callback function 'post' //show metabox in posts ); } /****************************************************************************************/ global $sidebar_layout; $sidebar_layout = array( 'default-sidebar' => array( 'id' => 'inception_sidebarlayout', 'value' => 'default', 'label' => __( 'Default Layout Set in', 'inception' ).' '.''.__( 'Theme Customizer', 'inception' ).'', 'thumbnail' => ' ' ), 'full-width' => array( 'id' => 'inception_sidebarlayout', 'value' => 'full-width', 'label' => __( '1 Column - Full Width', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '/1col.png' ), 'sidebar-content' => array( 'id' => 'inception_sidebarlayout', 'value' => 'sidebar-content', 'label' => __( '2 Column - Left Sidebar', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '2cl.png' ), 'content-sidebar' => array( 'id' => 'inception_sidebarlayout', 'value' => 'content-sidebar', 'label' => __( '2 Column - Right Sidebar', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '2cr.png' ), 'sidebar-sidebar-content' => array( 'id' => 'inception_sidebarlayout', 'value' => 'sidebar-sidebar-content', 'label' => __( '3 Column - Sidebar Sidebar Content', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '3cl.png' ), 'sidebar-content-sidebar' => array( 'id' => 'inception_sidebarlayout', 'value' => 'sidebar-content-sidebar', 'label' => __( '3 Column - Sidebar Content Sidebar', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '3cm.png' ), 'content-sidebar-sidebar' => array( 'id' => 'inception_sidebarlayout', 'value' => 'content-sidebar-sidebar', 'label' => __( '3 Column - Content Sidebar Sidebar', 'inception' ), 'thumbnail' => inception_ADMIN_IMAGES_URL . '3cr.png' ) ); /****************************************************************************************/ /** * Displays metabox to for sidebar layout */ function inception_sidebar_layout() { global $sidebar_layout, $post; // Use nonce for verification wp_nonce_field( basename( __FILE__ ), 'custom_meta_box_nonce' ); // Begin the field table and loop ?> ID, $field['id'], true ); if(empty( $meta ) ){ $meta='default'; } if( ' ' == $field['thumbnail'] ): ?>