I have a taxonomy for my custom post types.
This is the code:
add_action("manage_posts_custom_column", "my_custom_columns");
add_filter("manage_edit-homes_columns", "my_homes_columns");
function my_homes_columns($columns) //this function display the columns headings
{
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => "Home Title",
"description" => "Description",
"availability" => "Availability",
);
return $columns;
}
function my_custom_columns($column)
{
global $post;
if ("ID" == $column) echo $post->ID;
elseif ("description" == $column) echo $post->post_content;
elseif ("availability" == $column) echo $post->post_category;
}
<strong>This is the only piece of code that's not working:</strong>
elseif ("availability" == $column) echo $post->post_category;
Ho w do I echo the taxonomy there?
Sébastien | French WordpressDesigner answers:
replace
elseif ("availability" == $column) echo $post->post_category;
by
elseif ("availability" == $column) echo get_the_term_list( $post->ID, 'availability', '', ', ', '' );