Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Set the default column layout in the New Post section
- *
- * change every occurance of 'post' if you want to use it for pages or custom post types - example 'metaboxhidden_post' should be 'metaboxhidden_page' or 'metaboxhidden_custom_post_slug'
- */
- // get current user info
- global $current_user;
- get_currentuserinfo();
- $user_id = $current_user->ID;
- // array of hidden metaboxes (removing a box from this array would cause it to appear)
- $metaboxhidden_post = array (
- 0 => 'tagsdiv-post_tag',
- 1 => 'postexcerpt',
- 2 => 'trackbacksdiv',
- 3 => 'postcustom',
- 4 => 'commentstatusdiv',
- 5 => 'slugdiv',
- 6 => 'authordiv',
- 7 => 'formatdiv',
- 8 => 'categorydiv',
- 9 => 'postimagediv',
- );
- // metabox order and columns
- $new_metabox_order = array (
- // the right-hand column
- // make it empty
- 'side' => '',
- // the main column
- // set the order of boxes here, the ones in the $metaboxhidden_post array won't show up regardless of order
- 'normal' => 'submitdiv,postexcerpt,trackbacksdiv,postcustom,slugdiv,authordiv,tagsdiv-post_tag,categorydiv,formatdiv,commentstatusdiv,postimagediv',
- // I'm not sure about this one
- 'advanced' => '',
- );
- /*
- * update meta values for new users (or users who haven't messed with the screen settings yet)
- * comment the 'if'-lines to force the change to all users
- */
- if ( get_user_meta( $user_id, 'screen_layout_post', true ) == '' ) // check if the meta field is empty
- update_user_meta( $user_id, 'screen_layout_post', '1' ); // and update the value
- if ( get_user_meta( $user_id, 'metaboxhidden_post', true ) == '' )
- update_user_meta( $user_id, 'metaboxhidden_post', $metaboxhidden_post ); // hidden boxes
- if ( get_user_meta( $user_id, 'meta-box-order_post', trues ) == '' )
- update_user_meta( $user_id, 'meta-box-order_post', $new_metabox_order ); // order and columns
- // uncomment the next block of code to disable the side column altogether
- /*
- add_filter( 'screen_layout_columns', 'custom_screen_layout_columns' );
- function custom_screen_layout_columns( $columns ) {
- $columns['post'] = 1;
- return $columns;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment