Tagged: code, mpp-snippet
Hi Axel,
Here is a future proof way to do it/** * Reorder status in the dropdown. * * @param array $statuses statuses. * * @return array */ function mpp_custom_status_order( $statuses ) { // the ordered list, knowm. $ordered_statuses = array( 'public', 'loggedin', 'friendsonly', 'loggedin', 'private' ); // we will organize the list here. $new_ordered_statuses = array(); // Copy all valid status based on the ordered status. It only copies the statues specified by the ordered list. foreach ( $ordered_statuses as $ordered_status ) { if ( isset( $statuses[ $ordered_status ] ) ) { $new_ordered_statuses[ $ordered_status ] = $statuses[ $ordered_status ]; } } // now, some other values might still be remaining. $remaining_statues = array_diff( array_keys( $statuses ), $ordered_statuses ); foreach ( $remaining_statues as $remaining_key ) { $new_ordered_statuses[ $remaining_key ] = $statuses[ $remaining_key ]; } return $new_ordered_statuses; } add_filter( 'mpp_get_editable_statuses', 'mpp_custom_status_order' );
It might be even easier in future when we add the support for Sortable interface.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Mediapress status order’ is closed to new replies.
This topic is: resolved