Select Advanced field not showing as an Admin Column
Support › MB Admin Columns › Select Advanced field not showing as an Admin ColumnResolved
- This topic has 4 replies, 2 voices, and was last updated 3 years, 6 months ago by
Martin.
-
AuthorPosts
-
October 13, 2021 at 4:57 AM #31280
Martin
ParticipantI have a Select Advanced field which I want to show as an Admin column. It won't appear for me (although it was fine under an older version of MB).
I've tried showing other field types (such as a radio) from the same field group against my CPT and it shows fine.
Is Select Advanced just not compatible with Admin Columns or is there something additional I should be doing for it to display?
October 13, 2021 at 10:59 AM #31285Long Nguyen
ModeratorHi Martin,
The field
select_advanced
works as well with the extension MB Admin Columns. I also do not see that on my demo site. Can you please share the code that creates the fields?For example, this sample field shows the value in the admin column
function your_prefix_function_name( $meta_boxes ) { $meta_boxes[] = [ 'title' => __( 'Post Meta', 'your-text-domain' ), 'id' => 'post-meta', 'fields' => [ [ 'name' => __( 'Select Advanced', 'your-text-domain' ), 'id' => $prefix . 'select_advanced', 'type' => 'select_advanced', 'options' => [ 'a' => __( 'A', 'your-text-domain' ), 'b' => __( 'B', 'your-text-domain' ), 'c' => __( 'C', 'your-text-domain' ), ], 'multiple' => true, 'admin_columns' => 'after title', ], ], ]; return $meta_boxes; }
October 13, 2021 at 2:35 PM #31288Martin
ParticipantI see what the problem is - it's not generating the code from the builder for the field.
My code is generated as:
[ 'name' => __( 'Job Status', 'your-text-domain' ), 'id' => $prefix . 'job_status', 'type' => 'select_advanced', 'options' => [ 'Active' => __( 'Active', 'your-text-domain' ), 'Not Going Ahead' => __( 'Not Going Ahead', 'your-text-domain' ), 'Completed' => __( 'Completed', 'your-text-domain' ), 'Cancelled' => __( 'Cancelled', 'your-text-domain' ), ], 'std' => 'Active', ],
It does, however, still save the settings against the field in the builder.
October 13, 2021 at 10:06 PM #31301Long Nguyen
ModeratorHi,
If you use the Builder to create the field, please add the column name to the Column Position box. Screenshot https://imgur.com/PD4TBbm
Note: the admin column does not show the sub-field value in a group.
October 19, 2021 at 3:55 AM #31379Martin
ParticipantIt looks like there was a bug somewhere in the field generation code. I tried a number of the other fields in the form and they were all fine as an admin column. I also tried changing the field type of the one that wasn't working and it still wouldn't appear. I then created a new field using the same ID (having changed the ID of the non-working one) using all the same settings and it worked fine. All I can conclude is that there was some error behind the scenes but it is working fine now so all good.
-
AuthorPosts
- You must be logged in to reply to this topic.