I am using Magic Fields and have three different Write panels, for three categories of posts. Two of them I wanted to order alphabetically (Artists and Discography) and the other (News) I wanted chronologically.

Magic Fields adds "custom-write-panel-id=1" to the end of the URL to define which custom write panel the administrator is currently editing. So this code checks the current URL with "curPageURL()" and then strips the URL string from everything before "custom-write-panel-id=" with the php function strstr.

Now the variable $customwrite is "custom-write-panel-id=3". And then I strip this variable from the 22 first characters, leaving only the number. And then I check so that the plugin only order by title as long as the custom-write-panel-id is NOT equal to 3 ($admincatid != '3'), which is the number for News.

This is very close to what I am looking for. The only change is that I need to sort posts in the admin panel by expiration date. I'm using the post-expirator plugin which creates a meta key "expiration-date".