Created
May 24, 2012 21:31
-
-
Save matthaliski/2784361 to your computer and use it in GitHub Desktop.
Column Views for Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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