Admin Column Text Positioning

enter image description here

I have added a custom field to my custom post type and I have got it to output on the admin overview screen. However the text appears to be out of alignment with the column heading and I can’t figure out why.

Here is my code to the columns:

public function __construct() {
    add_filter( 'manage_'.$this->attributes['slug'].'_posts_columns', [$this,'customAdminColumns'] );
    add_action( 'manage_'.$this->attributes['slug'].'_posts_custom_column' , [$this,'customAdminColumnData'], 10, 2 );
}

public function customAdminColumns($columns){
    $insert=array(
        'file_type' =>  'File Type'
    );

    array_splice($columns,3,0,$insert);

    return $columns;
}

public function customAdminColumnData($column,$post_id){
    switch($column){
        case 'file_type':
            $media_id=  get_post_meta($post_id,'downloads_file',true);

            echo get_post_mime_type($media_id);

            break;
    }
}

I’m fairly sure I have just overlooked something but I can’t think what.

Can anyone provide any guidance on this?

Read more here:: Admin Column Text Positioning

Leave a Reply

Your email address will not be published. Required fields are marked *