// 統一物件投稿タイプを作成
function create_unified_property_system() {

// 投稿タイプ「property」を作成
register_post_type('property', array(
    'labels' => array(
        'name' => '物件',
        'singular_name' => '物件',
        'add_new' => '新規追加',
        'add_new_item' => '新しい物件を追加',
        'edit_item' => '物件を編集',
        'new_item' => '新しい物件',
        'view_item' => '物件を表示',
        'all_items' => '全ての物件'
    ),
    'public' => true,
    'has_archive' => true,
    'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
    'show_in_rest' => true,
    'menu_icon' => 'dashicons-building'
));

// プロジェクト分類(seki, tokyo, osakaなど)
register_taxonomy('property_project', 'property', array(
    'labels' => array(
        'name' => 'プロジェクト',
        'singular_name' => 'プロジェクト'
    ),
    'public' => true,
    'hierarchical' => true,
    'show_in_rest' => true,
    'rewrite' => array('slug' => 'project')
));

// 物件ステータス(賃貸中、空室)
register_taxonomy('property_status', 'property', array(
    'labels' => array(
        'name' => '物件ステータス',
        'singular_name' => '物件ステータス'
    ),
    'public' => true,
    'hierarchical' => true,
    'show_in_rest' => true,
    'rewrite' => array('slug' => 'status')
));

}
add_action(‘init’, ‘create_unified_property_system’);

PAGE TOP