內容簡介
以下是我推薦使用此類別的方式:
啟用這個外掛,或者將這個類別包含在你自己的外掛檔案中。
當你開始渲染包含文章清單的頁面時,定義一些欄位,然後實例化這個類別:
$cols = array(
array(
‘name’ => ‘restaurant_name’,
‘title’ => ‘餐廳名稱’,
‘css_class’ => ‘restaurant-name’,
‘is_default’ => true
),
array(
‘name’ => ‘cuisine_type’,
‘title’ => ‘美食類型’,
‘css_class’ => ‘cuisine-type’,
‘default_order’ => ‘desc’
)
);
$sortable = new BBG_CPT_Sort( $cols );
當你渲染表格時,你可以使用各種有趣的方法來創建列標。例如:
have_columns() ) : ?>
have_columns() ) : $sortable->the_column() ?>
<th class="the_column_css_class() ?>”>
<a href="the_column_next_link( ‘url’ ) ?>”>the_column_title() ?>
…
外掛標籤
開發者團隊
原文外掛簡介
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() ?>
