0

Good Afternoon,

I've created a CPT that mainly uses Featured Images, I would like to know how to rearrange this box to appear in the center where 'content editor' would go instead of the right (Default).

here is what i've so far,

$args = array('public' => true, 'label' => 'MisterZik', 
'menu_position' => 10,  'menu_icon' => 'dashicons-format-gallery',
'supports' => array('title', 'thumbnail'));

register_post_type('zik_images', $args);

Thanks!

I would like to move the box on the right to the center.

1 Answer 1

0

Pretty much what you can do is replace it, here's what I use:

/** Use "Featured Image" Box As A Custom Box **/
function post_type_featured_image() {
    add_meta_box(
        'postimagediv',
        __('Your Custom Title Here'),
        'post_thumbnail_meta_box', 
        'YOUR_POST_TYPE_HERE', 
        'normal', 
        'high'
    );
}
add_action( 'do_meta_boxes', 'post_type_featured_image' );

As an explaination you can read up on the add_meta_box() function.

You can replace the text here: __('Your Custom Title Here') with whatever you like, this is going to replace the "Featured Image" title.

You need to replace 'YOUR_POST_TYPE_HERE' with your actual post type, should you want to replace it on Built-In Pages, you would replace that text with page.

The Context is 'normal' to tell it to add it on the left instead of the sidebar and finally 'high' tells WP to add it toward the top. Again, for more indepth info please check out the add_meta_box() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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