Hi Phil,
If you need to add extra columns to the tickets list view, you’ll need tu use WordPress functions. You can find a good tutorial here: http://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post-types
However, for what you need, I’d recommend you to raise your voice here and wait for version 3.3.
Thank you Julien for you reply.
Here is the code I use for reference :
//* Add a client column to tickets and remove the Label column
add_filter('manage_ticket_posts_columns' , 'add_ticket_columns');
function add_ticket_columns($columns) {
unset($columns['taxonomy-ticket-tag']);
return array_merge($columns, array('client' => 'Client'));
}
//* Populate the client ticket column
add_action( 'manage_ticket_posts_custom_column', 'my_manage_ticket_columns', 10, 2 );
function my_manage_ticket_columns( $column, $post_id ) {
global $post;
switch( $column ) {
/* If displaying the 'client' column. */
case 'client' :
/* Get the post meta. */
$issuer = get_userdata( $post->post_author );
$client = $issuer->data->display_name;
/* If no client is found, output a default message. */
if ( empty( $client ) )
echo __( 'Unknown' );
else
printf( __( '%s' ), $client );
break;
/* Just break out of the switch statement for everything else. */
default :
break;
}
}
Is it any chance to make this column sortably?
where i have to add this lines?
Hi – An easier method might be the admin columns plugin. Give it a shot and see if it works for you.