Tales
Tales

Reputation: 1923

Custom function to change the excerpt title and a post thumbnail in a custom post type

I wanted to customise the excerpt text to make it closer to what my custom post type is about, so i decided to remove the metaboxes and create them again. I used this code in my functions.php:

function custom_post_type_boxes(){
    remove_meta_box( 'postimagediv', 'alma_client', 'side' );
    add_meta_box( 'postimagediv', __( 'Client logo' ), 'post_thumbnail_meta_box', 'alma_client', 'normal', 'high' );
    remove_meta_box( 'postexcerpt', 'alma_client', 'normal' );
    add_meta_box( 'postexcerpt', __( 'List of jobs for this client' ), 'post_excerpt_meta_box', 'alma_client', 'normal', 'core' );
}
add_action('do_meta_boxes', 'custom_post_type_boxes');

For some reason, the thumbnail metabox is working perfectly, but the excerpt metabox is not being painted. I think that maybe the problem is around the post_excerpt_meta_box which is the callback function, but i could be wrong.

Please help! I think i'm too close to fixing it, but can't figure it out.

Upvotes: 0

Views: 1393

Answers (1)

Tales
Tales

Reputation: 1923

Well, the problem was not with post_excerpt_meta_box. For some reason when i changed the priority from 'core' to 'high' it worked. I still don't know why it was invisible as 'core' if anyone can tell me, I still want to know. Thanks

The resulting line of code was:

add_meta_box( 'postexcerpt', __( 'List of jobs for this client' ), 'post_excerpt_meta_box', 'alma_client', 'normal', 'high' );

Upvotes: 2

Related Questions