0

I set up a plugin with a custom post type. Everything works so far regarding functionality, however I would like to change the way the admin page for the CPT looks.

register_post_type( 'myprefix_myposttype', myprefix_get_post_type_args_myposttype() );

function myprefix_get_post_type_args_myposttype() {
    $labels = array(
       ...
    );

    $args = array(
        'labels'             => $labels,
        'description'        => 'A custom post type',
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'myposttype' ),
        'capability_type'    => 'post',
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => 20,
        'supports'           => array( 'title', 'thumbnail' ),
        'taxonomies'         => array( 'category', 'post_tag' )
    );

    return $args;
}

I worked out how to change the table columns on the overview page with:

add_filter( 'manage_myposttype_posts_columns', 'myprefix_filter_myposttype_posts_columns' );
add_action( 'manage_myposttype_posts_custom_column', 'myprefix_myposttype_column', 10, 2 );

But I am still looking for a way to adjust the editing view of a single item. The only important parts are the title, a custom meta block, and the cover image (category and tags are not really needed). Therefore I would like to move the "block" with for the cover image from the right sidebar directly underneath the title. I know that I can just drag & drop it with the mouse, but I'd like to do it programmatically, so it is that way for this CPT by default after installation/activation.

Not that important, but nice-to-have would be having the blocks for categories and tags collapsed by default (or maybe not visible at all).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.