(Since my custom post type is a little long, I’ve for the sake of simplicity, copied over a dummy one)
What I am trying to do is, say I describe a few “similar” variables, i.e. price1, price2, price3, etc. would I be able to stack those values in a single column (as opposed to showing it over 3 columns), i.e. $price1<br />$price2<br />$price3
? The reasons are purely aesthetic as the custom post type columns would get really crowded quickly otherwise.
Thank you! (like said, the part below isn’t the actual code I’m using, but I thought it would be good if someone else would be searching the same thing)
add_filter("manage_edit-product_columns", "prod_edit_columns");
add_action("manage_posts_custom_column", "prod_custom_columns");
function prod_edit_columns($columns){
$columns = array(
"cb" => "<input type="checkbox" />",
"title" => "Product Title",
"description" => "Description",
"price1" => "Price1",
"catalog" => "Catalog",
);
return $columns;
}
function prod_custom_columns($column){
global $post;
switch ($column)
{
case "description":
the_excerpt();
break;
case "price": // Now here I have to define the field, but how would I drag in other subsequent price fields?
$custom = get_post_custom();
echo $custom["price"][0];
break;
case "catalog":
echo get_the_term_list($post->ID, 'catalog', '', ', ','');
break;
}
}
yea you can do just that. you only need to change the output function which in this case is
to display what you want for each column say your price
change it to something like:
hope this helps