A handy, extensible class for adding sortable columns your custom post type lists.
| Author: | Boone B Gorges (profile at wordpress.org) |
| WordPress version required: | WordPress |
| WordPress version tested: | WordPress |
| Plugin version: | 1.1 |
| Added to WordPress repository: | 23-05-2011 |
| Last updated: | 27-05-2011
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
| Rating, %: | 0 |
| Rated by: | 0 |
| Plugin URI: | http://github.com/boonebgorges/boones-sortabl... |
| Total downloads: | 2 828 |
| Active installs: | 10+ |
![]() Click to start download |
|
Here’s how I recommend using the class.
- Either activate this plugin, or include the class in your own plugin file.
- When you start to render the page with the post list, define some columns and then instantiate the class:
$cols = array(
array(
‘name’ => ‘restaurant_name’,
‘title’ => ‘Restaurant Name’,
‘css_class’ => ‘restaurant-name’,
‘is_default’ => true
),
array(
‘name’ => ‘cuisine_type’,
‘title’ => ‘Cuisine Type’,
‘css_class’ => ‘cuisine-type’,
‘default_order’ => ‘desc’
)
);
$sortable = new BBG_CPT_Sort( $cols ); - As you render your table, you can use all sorts of fun methods to create column headers. Example:
have_columns() ) : ?>
have_columns() ) : $sortable->the_column() ?>
<th class="the_column_css_class() ?>”>
<a href="the_column_next_link( ‘url’ ) ?>”>the_column_title() ?>
…
ChangeLog
