aliorg7
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Did a little bit of work and got it working.
Posting it here if anyone else needed it.
Since it was a group field in the form, it needed some more lines./** * Add extra admin columns to the entries list * in the post list table. * */ function add_acf_columns ( $columns ) { return array_merge ( $columns, [ 'first' => __ ( 'First Name' ), 'last' => __ ( 'Last Name' ), 'mail' => __ ( 'Email' ), 'number' => __ ( 'Whatsapp No.' ), ] ); } add_filter ( 'manage_af_entry_posts_columns', 'add_acf_columns' ); function custom_columns( $column ) { global $post; $groupField = get_field('field_5f45df9741e00'); //get the group field $fName = $groupField['name']; $lName = $groupField['last_name']; $email = $groupField['email']; $Whatsapp = $groupField['tel']; switch ( $column ) { case 'first': echo $fName ? $fName : '-'; break; case 'last': echo $lName ? $lName : '-'; break; case 'mail': echo $email ? $email : '-'; break; case 'number': echo $Whatsapp ? $Whatsapp : '-'; break; } } add_action( "manage_af_entry_posts_custom_column", "custom_columns", 10, 2 ); /** * Make sortable * */ function my_column_register_sortable( $columns ) { $columns['first'] = 'first'; $columns['last'] = 'last'; return $columns; } add_filter('manage_edit-af_entry_sortable_columns', 'my_column_register_sortable' );
- This reply was modified 3 years, 7 months ago by aliorg7.
Viewing 1 replies (of 1 total)