I’ve a customized publish sort referred to as E-book
and I need to add the writer and e-book creator customized columns within the edit web page.
I additionally need to fetch a selected worth from every fields (I created two fields for the above columns) to show in these two further columns. I truly can show with this code under however the level is I’ve to declare variable (for instance: the $worth
variable) for every information.
So might you please share me some concepts to show that with loop or somethings.
add_filter( 'manage_book_posts_columns', 'set_custom_edit_book_columns' );
add_action( 'manage_book_posts_custom_column' , 'custom_book_column', 10, 2 );
perform set_custom_edit_book_columns($columns) {
$worth = get_field( "contact_person" );
unset( $columns['author'] );
$columns['book_author'] = __( 'Writer', 'your_text_domain' );
$columns['publisher'] = __( 'Writer', 'your_text_domain' );
return $columns;
}
perform custom_book_column( $column, $post_id ) {
change ( $column ) {
case 'book_author' :
$worth = get_field( "contact_person" );
$phrases = get_the_term_list( $post_id , '$worth' , '' , ',' , '' );
if ( is_string( $worth ) )
echo $worth;
else
_e( 'Unable to get creator(s)', 'your_text_domain' );
break;
case 'writer' :
echo get_post_meta( $post_id , 'writer' , true );
break;
}
}