How to show items categories, within the sort interface
When viewing the sort interface, within the drag & drop section, the system outputs the current object items ( post types ). As default a line include a Thumbnail, the Post Title and the Post ID
To change the lines, insert substract or just modify the text is possible through a programmable filter apto/reorder_item_additional_details.
To append the item category along the other default texts, the following code can be used. This should be placed inside a custom file on /wp-content/mu-plugins/ directory, or within the theme/child-theme functions.php:
add_filter('apto/reorder_item_additional_details', 'theme_apto_reorder_item_additional_details', 10, 2); function theme_apto_reorder_item_additional_details( $additional_details, $post_data ) { $post_terms = wp_get_post_terms ( $post_data->ID, 'category', array ( 'fields' => 'names' ) ); $post_categories = ''; foreach ( $post_terms as $post_term_name ) { $post_categories .= $post_term_name . ' '; } $additional_details = '<b>' . $post_categories . '</b> - ' . $additional_details; return $additional_details; }
In above example, the code retrieve the category terms. This can be changed to any other custom-defined taxonomy.
Now, the outputs become as follow:
Subscribe
Login
0 Comments
Oldest
Newest
Most Voted
Inline Feedbacks
View all comments