Custom Fields
Re-Envisioned
Support MB Admin Columns Select Advanced field not showing as an Admin Column

  • Creator
    Topic
  • #31280
    Resolved Martin
    Participant

    I 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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #31285
    Long Nguyen
    Moderator

    Hi 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;
    }
    #31288
    Martin
    Participant

    I 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.

    #31301
    Long Nguyen
    Moderator

    Hi,

    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.

    #31379
    Martin
    Participant

    It 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.