Skip to content

Instantly share code, notes, and snippets.

@matthaliski
Created May 24, 2012 21:31
Show Gist options
  • Save matthaliski/2784361 to your computer and use it in GitHub Desktop.
Save matthaliski/2784361 to your computer and use it in GitHub Desktop.
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment