Closed patrickf0 closed 9 years ago
I'm not sure exactly what you are asking. Maybe does this page help? http://wordpress.stackexchange.com/questions/45/how-to-sort-the-admin-area-of-a-wordpress-custom-post-type-by-a-custom-field
Well I´ve got some sortable columns for my custom taxonomy.
public function sortable_columns_TicketTax( $aSortableHeaderColumns ) { // sortable_columns_{post type slug}
$column = array( 'name' => 'name', 'sort' => 'ticket_cat_sort', 'posts' => 'count');
return $column;
}
public function cell_TicketTax( $sCellHTML, $sColumnSlug, $iTermID ) { // cell_{extended class name}
$aOptions = get_option( 'TicketTax' );
switch ( $sColumnSlug ) {
case 'sort':
echo '<span style="text-align:center;">' . $aOptions[ $iTermID ][ 'ticket_cat_sort' ] . '</span>';
break;
}
}
But when I sort this column the orderby does not work properly. How do I set the algorithm for the $aOptions[ $iTermID ][ 'ticket_cat_sort' ] orderby?
Is it for edit-tags.php
or edit.php
?
edit-tags
Okay I committed an example of implementing customizing the sort algorithm of a custom column of taxonomy term listing table. It's already available in the master branch: https://github.com/michaeluno/admin-page-framework/archive/master.zip
The bottom line is that you have to code the part that sorts items as the framework cannot know what you want to do with them.
The steps that I did in the example are:
get_terms
hook.Hope it helps!
Hi, how do I set the orderby-algorithm for a sortable column?