I have created a custom post type called Members.
I then wanted to customise the display for this custom post type to display some custom meta which has been entered in the columns.
The columns are displaying but the data isn't showing up and I can't work out why.
add_filter( 'manage_edit-members_columns', 'my_columns_filter', 10, 1 );
function my_columns_filter( $columns ) {
$column_phone = array( 'phone' => 'Phone Number' );
$column_email = array( 'email' => 'Email Address' );
$column_membertype = array( 'member_type' => 'Member Type' );
$columns = array_slice( $columns, 0, 2, true ) + $column_phone + array_slice( $columns, 2, NULL, true );
$columns = array_slice( $columns, 0, 3, true ) + $column_email + array_slice( $columns, 3, NULL, true );
$columns = array_slice( $columns, 0, 4, true ) + $column_membertype + array_slice( $columns, 4, NULL, true );
return $columns;
}
add_action( 'manage_members_custom_column', 'my_column_action', 10, 2 );
function my_column_action( $column, $post_id ) {
global $post;
switch ( $column ) {
case 'phone':
echo get_post_meta($post_id, '_cricketss_phone', TRUE);
break;
case 'email':
echo get_post_meta($post_id, '_cricketss_email', TRUE);
break;
case 'member_type':
echo get_post_meta($post_id, '_cricketss_phone', TRUE);
break;
}
}
Any heads up would be appreciated.