Fields don't show in admin column
Support › MB Admin Columns › Fields don't show in admin columnResolved
- This topic has 9 replies, 4 voices, and was last updated 3 years, 7 months ago by
Long Nguyen.
-
AuthorPosts
-
April 15, 2021 at 2:31 PM #27265
Ulysse
ParticipantHello,
I build my metaboxes with MB builder.
In my MB, I have selected some fields to be displayed in the admin column but they're not. I looked at the php code which can be generated and it seems ok.
I follow the documentation. I don't understand why it does not. I use a very basic theme (Hello theme). But tried as well with 21.
April 15, 2021 at 8:25 PM #27274Long Nguyen
ModeratorHi,
Can you please share the PHP code generated or some screenshots of the field settings?
April 16, 2021 at 2:23 AM #27294Ulysse
ParticipantHere is the php code of my metabox:
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Fields for agent', 'your-text-domain' ), 'id' => 'fields-for-agent', 'post_types' => ['agent'], 'tab_style' => 'box', 'tab_default_active' => 'identity', 'geo' => [ 'api_key' => 'AIzaSyDdkC7vnU_nm-feorsOVR6FUWG_MCW3zzg', ], 'tabs' => [ 'identity' => [ 'label' => 'Identity', 'icon' => 'admin-users', ], 'location_and_languages' => [ 'label' => 'Location and Languages', 'icon' => 'admin-site', ], 'your_offer' => [ 'label' => 'Your offer', 'icon' => 'welcome-edit-page', ], ], 'fields' => [ [ 'name' => __( 'First name', 'your-text-domain' ), 'id' => $prefix . 'first_name_agent', 'type' => 'text', 'admin_columns' => [ 'position' => 'after', 'sort' => true, 'searchable' => true, 'filterable' => true, ], 'columns' => 6, 'visible' => [ 'when' => [['', '=', '']], 'relation' => 'or', ], 'tab' => 'identity', ], [ 'name' => __( 'Last name', 'your-text-domain' ), 'id' => $prefix . 'last_name_agent', 'type' => 'text', 'columns' => 6, 'tab' => 'identity', ], [ 'name' => __( 'Photo', 'your-text-domain' ), 'id' => $prefix . '_thumbnail_id', 'type' => 'image', 'label_description' => __( 'Photo which best promotes you', 'your-text-domain' ), 'max_file_uploads' => 1, 'admin_columns' => [ 'position' => 'before post_title', 'searchable' => true, ], 'tab' => 'identity', ], [ 'name' => __( 'Company', 'your-text-domain' ), 'id' => $prefix . 'company_agent', 'type' => 'text', 'columns' => 6, 'tab' => 'identity', ], [ 'name' => __( 'Website', 'your-text-domain' ), 'id' => $prefix . 'website_agent', 'type' => 'url', 'columns' => 6, 'tab' => 'identity', ], [ 'name' => __( 'Email', 'your-text-domain' ), 'id' => $prefix . 'email_agent', 'type' => 'email', 'columns' => 6, 'tab' => 'identity', ], [ 'name' => __( 'Tel', 'your-text-domain' ), 'id' => $prefix . 'tel_agent', 'type' => 'tel', 'columns' => 6, 'tab' => 'identity', ], [ 'name' => __( 'Address', 'your-text-domain' ), 'id' => $prefix . 'address_agent', 'type' => 'text', 'tab' => 'location_and_languages', ], [ 'name' => __( 'Country', 'your-text-domain' ), 'id' => $prefix . 'country_agent', 'type' => 'text', 'binding' => 'country', 'address_field' => 'address_agent', 'tab' => 'location_and_languages', ], [ 'name' => __( 'Map', 'your-text-domain' ), 'id' => $prefix . 'map_gm_agent', 'type' => 'map', 'api_key' => 'AIzaSyDdkC7vnU_nm-feorsOVR6FUWG_MCW3zzg', 'address_field' => 'address_agent', 'tab' => 'location_and_languages', ], [ 'name' => __( 'Language(s)', 'your-text-domain' ), 'id' => $prefix . 'languages', 'type' => 'taxonomy', 'taxonomy' => ['languages'], 'field_type' => 'select_advanced', 'add_new' => true, 'tab' => 'location_and_languages', ], [ 'name' => __( 'Countries of Operation', 'your-text-domain' ), 'id' => $prefix . 'countries_of_operation', 'type' => 'taxonomy', 'taxonomy' => ['country-of-operation'], 'field_type' => 'select_advanced', 'multiple' => true, 'add_new' => true, 'tab' => 'location_and_languages', ], [ 'name' => __( 'Background', 'your-text-domain' ), 'id' => $prefix . 'background_agent', 'type' => 'textarea', 'rows' => 10, 'tab' => 'your_offer', ], [ 'name' => __( 'Services', 'your-text-domain' ), 'id' => $prefix . 'services_agent', 'type' => 'textarea', 'rows' => 10, 'tab' => 'your_offer', ], [ 'name' => __( 'References', 'your-text-domain' ), 'id' => $prefix . 'references', 'type' => 'textarea', 'rows' => 10, 'tab' => 'your_offer', ], [ 'name' => __( 'Video Presentation', 'your-text-domain' ), 'id' => $prefix . 'video_presentation_agent', 'type' => 'url', 'std' => 'https://www.youtube.com/watch?v=ZRngEOnHnoc', 'tab' => 'your_offer', ], ], ]; return $meta_boxes;
April 16, 2021 at 2:24 AM #27295Ulysse
ParticipantHere is the php code of the custom post:
<?php add_action( 'init', 'your_prefix_register_post_type' ); function your_prefix_register_post_type() { $labels = [ 'name' => esc_html__( 'Agents', 'your-textdomain' ), 'singular_name' => esc_html__( 'Agent', 'your-textdomain' ), 'add_new' => esc_html__( 'Add New', 'your-textdomain' ), 'add_new_item' => esc_html__( 'Add new agent', 'your-textdomain' ), 'edit_item' => esc_html__( 'Edit Agent', 'your-textdomain' ), 'new_item' => esc_html__( 'New Agent', 'your-textdomain' ), 'view_item' => esc_html__( 'View Agent', 'your-textdomain' ), 'view_items' => esc_html__( 'View Agents', 'your-textdomain' ), 'search_items' => esc_html__( 'Search Agents', 'your-textdomain' ), 'not_found' => esc_html__( 'No agents found', 'your-textdomain' ), 'not_found_in_trash' => esc_html__( 'No agents found in Trash', 'your-textdomain' ), 'parent_item_colon' => esc_html__( 'Parent Agent:', 'your-textdomain' ), 'all_items' => esc_html__( 'All Agents', 'your-textdomain' ), 'archives' => esc_html__( 'Agent Archives', 'your-textdomain' ), 'attributes' => esc_html__( 'Agent Attributes', 'your-textdomain' ), 'insert_into_item' => esc_html__( 'Insert into agent', 'your-textdomain' ), 'uploaded_to_this_item' => esc_html__( 'Uploaded to this agent', 'your-textdomain' ), 'featured_image' => esc_html__( 'Featured image', 'your-textdomain' ), 'set_featured_image' => esc_html__( 'Set featured image', 'your-textdomain' ), 'remove_featured_image' => esc_html__( 'Remove featured image', 'your-textdomain' ), 'use_featured_image' => esc_html__( 'Use as featured image', 'your-textdomain' ), 'menu_name' => esc_html__( 'Agents', 'your-textdomain' ), 'filter_items_list' => esc_html__( 'Filter agents list', 'your-textdomain' ), 'items_list_navigation' => esc_html__( 'Agents list navigation', 'your-textdomain' ), 'items_list' => esc_html__( 'Agents list', 'your-textdomain' ), 'item_published' => esc_html__( 'Agent published', 'your-textdomain' ), 'item_published_privately' => esc_html__( 'Agent published privately', 'your-textdomain' ), 'item_reverted_to_draft' => esc_html__( 'Agent reverted to draft', 'your-textdomain' ), 'item_scheduled' => esc_html__( 'Agent scheduled', 'your-textdomain' ), 'item_updated' => esc_html__( 'Agent updated', 'your-textdomain' ), 'text_domain' => esc_html__( 'your-textdomain', 'your-textdomain' ), ]; $args = [ 'label' => esc_html__( 'Agents', 'your-textdomain' ), 'labels' => $labels, 'description' => '', 'public' => true, 'hierarchical' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'show_in_rest' => true, 'menu_position' => 20, 'query_var' => true, 'can_export' => true, 'delete_with_user' => true, 'has_archive' => true, 'rest_base' => '', 'show_in_menu' => true, 'menu_icon' => 'dashicons-admin-generic', 'capability_type' => 'post', 'supports' => ['title', 'editor', 'thumbnail', 'custom-fields', 'revisions', 'author', 'post-formats', 'excerpt', 'trackbacks', 'comments'], 'taxonomies' => ['country-of-operation', 'location-of-agent', 'languages'], 'rewrite' => [ 'with_front' => false, ], ]; register_post_type( 'agent', $args ); }
April 16, 2021 at 11:11 AM #27305Long Nguyen
ModeratorHi,
The columns Title has the ID
title
, it should be'admin_columns' => [ 'position' => 'before title', 'searchable' => true, ],
The builder also suggests the default column IDs of the post
title
,author
,tag
,categories
...April 16, 2021 at 2:13 PM #27311Ulysse
ParticipantOK. Understood. It works when I add the parameter "location".
I only use the builder to create my metabox. You should add an asterix to tell the parameter "column position" is mandatory.April 16, 2021 at 7:36 PM #27318Long Nguyen
ModeratorThanks for your feedback. I've added this feature request to the backlog development.
April 21, 2021 at 4:26 AM #27443[email protected]
ParticipantHi, I am using MetaBox Builder only(no Code) and I cannot get any fields columns to show when I configure "Show as an admin column".
I'm using the latest update Meta box 5.3.9 Meta AIO 1.13.8 (with all AIO plugins activated) how do I show/get Admin columns to work?
It only works if everything (column Position) is set to "before - title" any other combination (of before and after with any other field) will not work, also no filter columns etc - Using Astra Pro Theme AND I've disabled all other plugins.
Kindest regards
JaySeptember 7, 2021 at 9:15 AM #30642Way Leong
ParticipantIt happened to me too, I am using Oxygen Builder 3.9 Alpha 1, a custom field group was created where it was grouped with other subcategories of text area, by ticking the admin column checkboxes the data does show up however it appear as "array"
September 7, 2021 at 8:40 PM #30653Long Nguyen
ModeratorHi Wayleong,
The admin columns do not work with the subfields in a group, only work with the top field.
-
AuthorPosts
- You must be logged in to reply to this topic.