I'm having hard time with this. I know WP_List_Table
will generate the table for you and the get_columns
will set the header
and footer
of the table that came from an array well in most case that came from the database.
What if I have this database table and it's fields
+----------------+
| Field | Type |
+-------+--------+
| id | int |
+-------+--------+
| name | varchar|
+-------+--------+
Then in my get_columns
function.
function get_columns() {
$columns = array(
'id' => 'ID',
'name' => 'Name'
);
return $columns;
}
So with that.. It'll give me html table like this..
+--------------------+
| ID | Name |
+-------+------------+
| 1 | Foo |
+-------+------------+
| 2 | Bar |
+-------+------------+
BUT (1) how can I add another header and footer that does not belong in the database? I would want to achieve something like this..
+--------------------+--------+
| ID | Name | Option |
+-------+------------+--------+
| 1 | Foo | Click |
+-------+------------+--------+
| 2 | Bar | Click |
+-------+------------+--------+
(2) I would also want to wrap the Click
text in a <form>
so I can do some actions with it. I don't know how to deal with this. Any help would be much appreciated.