Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'create_prodotti' );
- function create_prodotti() {
- $args = array(
- 'labels' => post_type_labels( 'Prodotti' ),
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => true,
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' => null,
- 'taxonomy' => array (''),
- 'supports' => array('title',
- 'editor',
- 'author',
- 'thumbnail',
- 'excerpt',
- 'comments',
- 'custom-fields' // pannello custom fields
- )
- );
- register_post_type( 'prodotti', $args );
- }
- function post_type_labels($name) {
- return array(
- 'name' => _x( $name, 'post type general name' ),
- 'singular_name' => _x( 'Prodotto', 'post type singular name' ),
- 'add_new' => __( 'Aggiungi nuovo' ),
- 'add_new_item' => __( 'Aggiungi nuovo prodotto'),
- 'edit_item' => __( 'Modifica prodotto'),
- 'new_item' => __( 'Nuovo prodotto' ),
- 'view_item' => __( 'Vedi prodotto' ),
- 'search_items' => __( 'Cerca'. $name ),
- 'not_found' => __( 'Nessun prodotto trovato'),
- 'not_found_in_trash' => __( 'Non ci sono ' . $name . ' prodotti nel Cestino' ),
- 'parent_item_colon' => ''
- );
- }
- function add_custom_taxonomies() {
- // Add new "Locations" taxonomy to Posts
- register_taxonomy('marchio', 'prodotti', array(
- // Hierarchical taxonomy (like categories)
- 'hierarchical' => true,
- // This array of options controls the labels displayed in the WordPress Admin UI
- 'labels' => array(
- 'name' => 'Marchi',
- 'singular_name' => 'Marchio',
- 'search_items' => 'Cerca Marchio',
- 'all_items' => 'Tutti i Marchi' ,
- 'parent_item' => 'Parent Marchio',
- 'parent_item_colon' => 'Parent Marchio:',
- 'edit_item' => 'Edit Marchio',
- 'update_item' => 'Update Marchio' ,
- 'add_new_item' => 'Nuovo Marchio' ,
- 'new_item_name' => 'New Marchio Name',
- 'menu_name' => 'Marchi',
- ),
- // Control the slugs used for this taxonomy
- 'rewrite' => array(
- 'slug' => 'marchio', // This controls the base slug that will display before each term
- 'with_front' => false, // Don't display the category base before "/locations/"
- 'hierarchical' => true,// This will allow URL's like "/locations/boston/cambridge/"
- 'query_var' => true,
- ),
- ));
- }
- add_action( 'init', 'add_custom_taxonomies', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement