setting columns in admin post_type
-
Hello,
I am trying to add columns in the admin pod post_type area. I’ve created the “book” pod as a separate table in my database but I am unable to display any value for these 2 fields. Any help? Thx.
Here is the code:
function setting_column_book( $column ) { $column['ref'] = 'Ref'; $beginning = array_slice( $column, 0 ,1 ); $beginning[ 'id' ] = __( 'ID'); $ending = array_slice( $column, 1 ); $column = array_merge( $beginning, $ending ); return $column; } add_filter( 'manage_book_posts_columns', 'setting_column_book' ); function custom_value_column( $column, $post_id ) { switch ( $column ) { case 'ref' : echo get_post_meta( $post_id , 'ref' , true ); break; case 'id' : echo get_post_meta( $post_id , 'id' , true ); break; } } add_action( 'manage_book_posts_column' , '_custom_value_column', 10, 2 );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘setting columns in admin post_type’ is closed to new replies.