Estou precisando retornar valores para que sejam exibidos nas colunas do post type, porém não estou conseguindo retornar nada, como deve ser feito?
Código:
add_action( 'init', 'create_eventcategory_taxonomy', 0);
add_filter ("manage_edit-tf_events_columns", "tf_events_edit_columns");
add_action ("manage_posts_custom_column", "tf_events_custom_columns");
add_action('init', 'create_event_postype');
function create_event_postype() {
$labels = array(
'name' => _x('Events', 'post type general name'),
'singular_name' => _x('Event', 'post type singular name'),
'add_new' => _x('Add New', 'events'),
'add_new_item' => __('Add New Event'),
'edit_item' => __('Edit Event'),
'new_item' => __('New Event'),
'view_item' => __('View Event'),
'search_items' => __('Search Events'),
'not_found' => __('No events found'),
'not_found_in_trash' => __('No events found in Trash'),
'parent_item_colon' => '',
);
$args = array(
'label' => __('Events'),
'labels' => $labels,
'public' => true,
'can_export' => true,
'show_ui' => true,
'_builtin' => false,
'capability_type' => 'post',
'menu_icon' => get_bloginfo('template_url').'/functions/images/event_16.png',
'hierarchical' => false,
'rewrite' => array( "slug" => "events" ),
'supports'=> array('title', 'thumbnail', 'excerpt', 'editor') ,
'show_in_nav_menus' => true,
'taxonomies' => array( 'tf_eventcategory', 'post_tag')
);
register_post_type( 'tf_events', $args);
}
function create_eventcategory_taxonomy() {
$labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'popular_items' => __( 'Popular Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
'separate_items_with_commas' => __( 'Separate categories with commas' ),
'add_or_remove_items' => __( 'Add or remove categories' ),
'choose_from_most_used' => __( 'Choose from the most used categories' ),
);
register_taxonomy('tf_eventcategory','tf_events', array(
'label' => __('Event Category'),
'labels' => $labels,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'event-category' ),
));
}
function tf_events_edit_columns($columns) {
$columns = array(
"cb" => "<input type=\"checkbox\" />",
"tf_col_ev_cat" => "Category",
"tf_col_ev_date" => "Dates",
"tf_col_ev_times" => "Times",
"tf_col_ev_thumb" => "Thumbnail",
"title" => "Event",
"tf_col_ev_desc" => "Description",
);
return $columns;
}
function tf_events_custom_columns($column){
global $post;
$custom = get_post_custom();
switch ($column){
case "tf_col_ev_cat":
echo 'teste1';
break;
case "tf_col_ev_date":
echo 'teste2';
break;
case "tf_col_ev_times":
echo 'teste3';
break;
case "tf_col_ev_thumb":
echo 'teste4';
break;
case "tf_col_ev_desc";
echo 'teste5';
break;
}
}
Quero deixar desta forma: