Show Thumbs in Admin Column

Support MB Admin Columns Show Thumbs in Admin ColumnResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27153
    JoeJoe
    Participant

    Hello,
    I am very new to Meta Box. I am tying to show the featured images in my admin column. The post-type is called team-member and each post has an image. I am using the following snippet in the wp plugin snippets, but as soon as I save and activate it, the site breaks it & tells me -> MB_Admin_Columns_Post is unknown ...

    add_action( 'admin_init', function() {
        class My_Featured_Image_Columns extends MB_Admin_Columns_Post {
            public function columns( $columns ) {
                $columns  = parent::columns( $columns );
                $position = 'before';
                $target   = 'title';
                $this->add( $columns, 'featured_image', 'Featured Image', $position, $target );
                // Add more if you want
                return $columns;
            }
            public function show( $column, $post_id ) {
                switch ( $column ) {
                    case 'featured_image':
                        the_post_thumbnail( [40, 40] );
                        break;
                    // More columns
                }
            }
        }
    
        new My_Featured_Image_Columns( 'team-member', array() );
    } );
    #27154
    Long NguyenLong Nguyen
    Moderator

    Hi Joe,

    Thank you for reaching out.

    The class MB_Admin_Columns_Post is deprecated, please use the class \MBAC\Post. Get more details on the documentation https://docs.metabox.io/extensions/mb-admin-columns/#custom-admin-columns.

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