My web site has two customized sorts: Public sale and Lot. Tons are linked to an Public sale by way of the post_parent area. I added an Public sale column to the Tons record within the admin space.
perform theme_lot_custom_columns($columns){
$new = array();
foreach($columns as $key => $worth) {
if ($key=='date') {
// Put the Public sale column earlier than the Date column
$new['auction'] = __('Public sale');
}
$new[$key] = $worth;
}
return $new;
}
add_filter('manage_lot_posts_columns', 'theme_lot_custom_columns');
perform theme_lot_custom_column($column, $post_id) {
if ($column === 'public sale'){
$submit = 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);
I would prefer to make this Public sale column sortable alphabetically by the public sale title. I believed that including the next code was sufficient, however no.
perform theme_lot_sortable_columns($columns) {
$columns['auction'] = 'public sale';
return $columns;
}
add_filter('manage_edit-lot_sortable_columns', 'theme_lot_sortable_columns');
Any assist could be appreciated.
Thanks!