I have another dumb question, but I can’t get one thing 🙂
I’ve found this very good article on creating custom post types:
http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/
I’m not sure how Step 4 works.
This guys writes:
add_action("manage_posts_custom_column", "portfolio_custom_columns");
add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");
function portfolio_edit_columns($columns){
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"title" => "Portfolio Title",
"description" => "Description",
"year" => "Year Completed",
"skills" => "Skills",
);
return $columns;
}
function portfolio_custom_columns($column){
global $post;
switch ($column) {
case "description":
the_excerpt();
break;
case "year":
$custom = get_post_custom();
echo $custom["year_completed"][0];
break;
case "skills":
echo get_the_term_list($post->ID, 'Skills', '', ', ','');
break;
}
}
I have two different post types (‘books’ and ‘movies’).
And I can’t get how to link this code with right one!
I’m sure I’m missing something (most likely in the code), but I didn’t see him including “portfolio_edit_columns” anywhere in the code.
I have found this in WP Codex: http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column and it seems like
manage_edit-${post_type}_columns
does the magic, but I’ve tried both manage_edit-books_columns and manage_edit-movies_columns and nothing! 🙂
So how to create two separate column layouts for different post types?