matthaliski
5/24/2012 - 9:31 PM

Column Views for Wordpress

Column Views for Wordpress

//Define the colums we want to see in the work view
add_filter("manage_edit-work_columns", "work_edit_columns");
function work_edit_columns($columns)
{
    $columns = array(
        "cb" => "<input type=\"checkbox\" />",
        "title" => "Project",
        "client" => "Client",
        "disciplines" => "Disciplines",
        "comments" => "<img alt='Comments' src='http://matthaliski.com/wp-admin/images/comment-grey-bubble.png'>",
        "date" => "Date",
    );
  
    return $columns;
}
  
//Controls what columns we see in the list view
add_action("manage_posts_custom_column",  "work_custom_columns");
function work_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "title":
            the_title();
            break;
        case "client":
            echo get_the_term_list($post->ID, 'client', '', ', ','');
            break;
             
        case "disciplines":
            echo get_the_term_list($post->ID, 'disciplines', '', ', ','');
            break;
    }
}