通常の投稿とカスタム投稿を併用する場合、管理画面の投稿一覧の項目がカスタム投稿だと少ないので、できるだけ投稿に近づけるためのコード
※スラッグがnewsの場合
add_action('admin_menu', 'myplugin_add_custom_box_news');
function myplugin_add_custom_box_news()
{
if (function_exists('add_meta_box')) {
add_meta_box('myplugin_sectionid', __('投稿者', 'myplugin_textdomain'), 'post_author_meta_box', 'news', 'advanced');
}
}
function manage_news_columns ($columns) {
$columns['author'] = '投稿者';
return $columns;
}
function add_news_column ($column, $post_id) {
if ('author' == $column) {
$value = get_the_term_list($post_id, 'author');
echo attribute_escape($value);
}
}
add_filter('manage_posts_columns', 'manage_news_columns');
add_action('manage_posts_custom_column', 'add_news_column', 10, 2);