自定义函数可更改自定义帖子类型中的摘录标题和帖子缩略图


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

我想自定义摘录文本,使其更接近我的自定义帖子类型,所以我决定删除元框并重新创建它们。我在函数中使用了此代码。hp:

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');

出于某种原因,缩略图代谢盒运行良好,但摘录代谢盒没有绘制。我认为问题可能出在回调函数post_excerpt_meta_box上,但我可能错了。

请帮忙!我想我离修复它太近了,但我想不出来。

问题不在于post_excerpt_meta_box。出于某种原因,当我将优先级从'core'更改为'high'时,它起了作用。我仍然不知道为什么它是隐形的'core'如果有人能告诉我,我仍然想知道。感谢

由此产生的代码行是:

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