我的网站有两种自定义类型:拍卖和拍卖。地块通过post_parent 领域我在管理区的地块列表中添加了一个拍卖栏。
function theme_lot_custom_columns($columns){
$new = array();
foreach($columns as $key => $value) {
if ($key==\'date\') {
// Put the Auction column before the Date column
$new[\'auction\'] = __(\'Auction\');
}
$new[$key] = $value;
}
return $new;
}
add_filter(\'manage_lot_posts_columns\', \'theme_lot_custom_columns\');
function theme_lot_custom_column($column, $post_id) {
if ($column === \'auction\'){
$post = get_post($post_id);
if ($post->post_parent) {
$post_parent = get_post($post->post_parent);
echo \'<a href="\' . get_edit_post_link($post_parent->ID). \'">\' . $post_parent->post_title . \'</a>\';
}
}
}
add_action(\'manage_lot_posts_custom_column\', \'theme_lot_custom_column\', 5, 2);
我想让这个拍卖栏按拍卖标题的字母顺序排序。我认为添加以下代码就足够了,但没有。function theme_lot_sortable_columns($columns) {
$columns[\'auction\'] = \'auction\';
return $columns;
}
add_filter(\'manage_edit-lot_sortable_columns\', \'theme_lot_sortable_columns\');
任何帮助都将不胜感激。谢谢