Home Plugins boones sortable columns
Boone's Sortable Columns logo

Boone's Sortable Columns

by Boone Gorges on WordPress.org

A handy, extensible class for adding sortable columns your custom post type lists.

(0)

Here’s how I recommend using the class.

  1. Either activate this plugin, or include the class in your own plugin file.
  2. 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 );
  3. 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() ?>
”>the_column_title() ?>

Active installations10+
Weekly downloads
11-8.33%
Version1.1
Last updated5/27/2011
WordPress version3.1
Tested up to3.2.1
Tags
columnscustom post typestables