The WP_Table class is intended to present a consistent “look” for sortable tables in the WP Admin backend. It contains most everything needed to present, paginate, process, sort and search a given table.
However, the search functionality is somewhat limited in that it will search every column of data. What if only one column is to be searched? This expansion to the WP_Table class presents a dropdown box with all specified column header names and allows for the selection of one specific column name, which will be the only column searched and reported in return.
- Define the columns that are to be searched.
- Use the column definitions to generate a drop box within the search form and display it as part of the table header.
- Retrieve the URL parameter selected from the drop box and use it as part of the search routine.
All of the following functions are a part of the local class definition that extends the WP_Table class.
The examples here are from the WP Security Log plugin, which records information on login attacks and error 404 attacks. These particular examples are from the Login Attacks section and therefore record such information as the attempted user name and password, the IP address from which the attack came, the reported user platform, the user agent and the date/time stamp of the attempt.
My Amazon Wishlist
My DeviantArt Gallery
My Facebook Page
My Goodreads Bookshelf
My Smashwords Catalog
My Twitter Feed
My WordPress Profile