That should be possible, but it looks pretty complicated. As you have undoubtedly seen, the display_rows
method just passes a single line and there’s no counter. This means that the row number must be in the $item
variable for you to extract it. Since it is not there natively, you must insert it before you start displaying the table.
Luckily, there is a method expressly designed to do this, prepare_items
. This is an abstract class, meaning it must be filled in by child classes that use this class. Take, for instance, a look at the way it is implemented in WP_Posts_List_Table
.
So what you’ll have to is override the existing prepare_items
of the child class you are working with, and loop through the rows to add a new property $row_count
to each one of them. Then, when you implement column_$custom( $item ) you can extract $row_count
.
Disclaimer: obviously I didn’t test this myself, it’s just a concept I think should work.