Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author julien731

    (@julien731)

    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.

    Thread Starter Phil Brunet

    (@fabrunet)

    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?

    jankre

    (@jankre)

    where i have to add this lines?

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi – An easier method might be the admin columns plugin. Give it a shot and see if it works for you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add a column to admin tickets list’ is closed to new replies.