Skip to content

Instantly share code, notes, and snippets.

@vwasteels
Last active December 17, 2015 19:09
Show Gist options
  • Save vwasteels/5658019 to your computer and use it in GitHub Desktop.
Save vwasteels/5658019 to your computer and use it in GitHub Desktop.
<?php
// post_type : flux
register_post_type( 'flux', array(
'labels' => array(
'name' => 'Flux',
'singular_name' => 'Flux',
'add_new' => 'Écrire un flux',
'add_new_item' => 'Écrire un flux',
'edit_item' => 'Modifier le flux',
'new_item' => 'Nouveau flux',
'all_items' => 'Tous les flux',
'view_item' => 'Afficher le flux',
'search_items' => 'Rechercher dans les flux',
'not_found' => 'Aucun flux trouvée',
'not_found_in_trash' => 'Aucun flux trouvé dans la corbeille',
'parent_item_colon' => '',
'menu_name' => 'Flux'
),
'public' => false,
'publicly_queryable' => false,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'flux' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title')
) );
// Taxonomy : theme
register_taxonomy( 'theme', array('flux'), array(
'hierarchical' => false,
'show_tagcloud' => false,
'labels' => array(
'name' =>'Thème',
'singular_name' =>'Thème',
'menu_name' =>'Thèmes',
'search_items' =>'Rechercher dans les thème',
'popular_items' =>'Thèmes populaires',
'all_items' =>'Tous les thèmes',
'edit_item' =>'Modifier le thème',
'update_item' =>'Mettre à jour le thème',
'add_new_item' =>'Ajouter un thème',
'new_item_name' =>'Nom du nouvel thème',
'separate_items_with_commas' =>'Séparer les thème par une virgule',
'add_or_remove_items' =>'Ajouter ou supprimier un thème',
'choose_from_most_used' =>'Choisir dans les thème les plus populaires',
),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => false,
'rewrite' => array(
'hierarchical' => false,
'slug' => 'tagart'
)
) );
// template : taxonomy-theme.php
/*
* Flux list columns
*/
add_filter('manage_edit-flux_columns', 'modify_flux_list_admin');
function modify_flux_list_admin($columns){
// unset useless
//unset($columns['date']);
// add and return
$columns['thumbnail'] = 'Thumbnail';
return $columns;
}
add_action('manage_flux_posts_custom_column', 'manage_flux_columns', 10, 2);
function manage_flux_columns($column_name, $id) {
switch ($column_name) {
case 'thumbnail':
// display une image
echo "display une image !";
break;
default:
break;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment