Читать книгу Professional WordPress Plugin Development - Brad Williams - Страница 112
Tables
ОглавлениеHTML tables are a great way to display rows and columns of data in an easy‐to‐read layout. Tables can easily be styled in WordPress using the widefat
class.
<table class="widefat"> <thead> <tr> <th>Name</th> <th>Favorite Holiday</th> </tr> </thead> <tfoot> <tr> <th>Name</th> <th>Favorite Holiday</th> </tr> </tfoot> <tbody> <tr> <td>Brad Williams</td> <td>Halloween</td> </tr> <tr> <td>Ozh Richard</td> <td>Talk Like a Pirate</td> </tr> <tr> <td>Justin Tadlock</td> <td>Christmas</td> </tr> </tbody> </table>
The widefat
class has specific styles set for the thead
and tfoot
HTML tags. This styles the header and footer of your table to match all other tables on the Dashboard. The class can also style all table data, as shown in Figure 3‐14.
FIGURE 3‐14: Table style