When you register a custom column like so:
//Register thumbnail column for au-gallery type
add_filter('manage_edit-au-gallery_columns', 'thumbnail_column');
function thumbnail_column($columns) {
$columns['thumbnail'] = 'Thumbnail';
return $columns;
}
by default it appears as the last one on the right.
How can I change the order?
What if I want to show the above column as the first one or the second one?
Thank you in advance
You are basically asking a PHP question, but I’ll answer it because it’s in the context of WordPress. You need to rebuild the columns array, inserting your column before the column you want it to be left of:
add_filter('manage_posts_columns', 'thumbnail_column');
function thumbnail_column($columns) {
$new = array();
foreach($columns as $key => $title) {
if ($key=='author') // Put the Thumbnail column before the Author column
$new['thumbnail'] = 'Thumbnail';
$new[$key] = $title;
}
return $new;
}