Codice PHP:
add_action( 'init', 'register_cpt_appartamento' );
function register_cpt_appartamento() {
$labels = array(
'name' => _x( 'Appartamenti', 'appartamento' ),
'singular_name' => _x( 'Appartamento', 'appartamento' ),
'add_new' => _x( '+ Appartamento', 'appartamento' ),
'add_new_item' => _x( '+ nuovo Appartamento', 'appartamento' ),
'edit_item' => _x( 'Modifica Appartamento', 'appartamento' ),
'new_item' => _x( '+ Appartamento', 'appartamento' ),
'view_item' => _x( 'Guarda Appartamento', 'appartamento' ),
'search_items' => _x( 'Cerca Appartamenti', 'appartamento' ),
'not_found' => _x( 'Nessun appartamenti found', 'appartamento' ),
'not_found_in_trash' => _x( 'Nessun appartamento nel cestino', 'appartamento' ),
'parent_item_colon' => _x( 'Parent Appartamento:', 'appartamento' ),
'menu_name' => _x( 'Appartamenti', 'appartamento' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
'taxonomies' => array( 'post_tag', 'category '),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => false,
'query_var' => true,
'can_export' => true,
'rewrite' => array( 'slug' => 'cool', 'with_front' => true ),
'capability_type' => 'post',
);
register_post_type( 'appartamento', $args );
}