Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created a plugin using custom post types and I need to force the default two column post page to a single column. At the same time, the Publish metabox must move to the bottom. I need to do this via the functions some how.

I have some solutions from WPSE, but the only solution I've found actually hides the "Publish" metabox. I can't seem to figure out why.

Any ideas of how to do this?

share|improve this question

2 Answers 2

There is a filter called get_user_option_meta-box-order_{$page} where $page is the name of the post type. Just make sure that submitdiv is the last value in the array:

add_filter( 'get_user_option_meta-box-order_post', 'wpse25793_one_column_for_all' );
function wpse25793_one_column_for_all( $order )
{
    return array(
        'normal'   => join( ",", array(
            'postexcerpt',
            'formatdiv',
            'trackbacksdiv',
            'tagsdiv-post_tag',
            'categorydiv',
            'postimagediv',
            'postcustom',
            'commentstatusdiv',
            'slugdiv',
            'authordiv',
            'submitdiv',
        ) ),
        'side'     => '',
        'advanced' => '',
    );
}
share|improve this answer
1  
I tried your code. But its not working. My post metabox order looks like this as of now. Title,submit,content,custom metaboxes added by plugins,tags –  Giri Jan 2 '12 at 8:42

One approach is to remove the original metabox, and then to re-add that metabox, with updated parameters. For example, this will move the "Featured Image" meta box from the side column to the main column, for a custom post type with a slug cpt-slug:

Edit

The parameter for the Publish meta box is submitdiv, and the correct callback is post_submit_meta_box(); I've updated the code below to reflect these correct parameters. I've also changed the add_meta_box() $context parameter from 'high' to 'low', so that the Publish meta box will be added at the bottom:

<?php
function wpse25793_move_post_metaboxes( $post ) {
    global $wp_meta_boxes;

    remove_meta_box( 'submitdiv', 'cpt-slug', 'side' );
    add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'cpt-slug', 'normal', 'low' );
}
add_action( 'add_meta_boxes_cpt-slug', 'wpse25793_move_post_metaboxes' );
?>

The approach should be the same for the "Publish" meta box. You just need to remove/add the publish meta box instead of the featured image meta box.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.