Created
June 26, 2013 11:34
-
-
Save sutter/5866738 to your computer and use it in GitHub Desktop.
Custom Post Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom post type | |
function codex_custom_init() { | |
$labels = array( | |
'name' => 'Projets', | |
'singular_name' => 'Projet', | |
'add_new' => 'Ajouter', | |
'add_new_item' => 'Ajouter un projet', | |
'edit_item' => 'Editer le projet', | |
'new_item' => 'Nouveau projet', | |
'all_items' => 'Tout les projets', | |
'view_item' => 'Voir le projet', | |
'search_items' => 'Rechercher un projet', | |
'not_found' => 'Aucun projet trouvé', | |
'not_found_in_trash' => 'Aucun projet trouvé dans la corbeille', | |
'parent_item_colon' => '', | |
'menu_name' => 'projets' | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'projet' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => array( 'title', 'editor','thumbnail', 'excerpt', 'author','custom-fields' ) | |
); | |
register_post_type( 'projet', $args ); | |
register_taxonomy_for_object_type('post_tag', 'projet','show_tagcloud=1&hierarchical=true'); | |
$labelsCat1 = array( | |
'name' => _x( 'catégorie', 'post type general name' ), | |
'singular_name' => _x( 'catégorie', 'post type singular name' ), | |
'add_new' => _x( 'Ajouter', 'catégorie' ), | |
'add_new_item' => __( 'Ajouter une catégorie' ), | |
'edit_item' => __( 'Modifier la catégorie' ), | |
'new_item' => __( 'Nouvelle catégorie' ), | |
'view_item' => __( 'Voir la catégorie' ), | |
'search_items' => __( 'Rechercher une catégorie' ), | |
'not_found' => __( 'Aucune catégorie trouvée' ), | |
'not_found_in_trash' => __( 'Aucune catégorie trouvée dans la corbeille' ), | |
'parent_item_colon' => '' | |
); | |
register_taxonomy("productions-portfolio", array("projet"), array("hierarchical" => true, "labels" => $labelsCat1, "rewrite" => true)); | |
$labelsCat2 = array( | |
'name' => _x( 'client', 'post type general name' ), | |
'singular_name' => _x( 'client', 'post type singular name' ), | |
'add_new' => _x( 'Ajouter', 'client' ), | |
'add_new_item' => __( 'Ajouter un client' ), | |
'edit_item' => __( 'Modifier le client' ), | |
'new_item' => __( 'Nouveau client' ), | |
'view_item' => __( 'Voir le client' ), | |
'search_items' => __( 'Rechercher un client' ), | |
'not_found' => __( 'Aucun client trouvé' ), | |
'not_found_in_trash' => __( 'Aucun client trouvé dans la corbeille' ), | |
'parent_item_colon' => '' | |
); | |
register_taxonomy("client", array("projet"), array("hierarchical" => true, "labels" => $labelsCat2, "rewrite" => true)); | |
} | |
add_action( 'init', 'codex_custom_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment