Custom Fields
Re-Envisioned
Support MB Admin Columns Show Thumbs in Admin Column

  • Creator
    Topic
  • #27153
    Resolved joe@la-palma-tauchen.com
    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() );
    } );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.