While working on one of my WordPress sites I stumbled upon the need to customize (reorder) the column order while I was adding new columns on some admin pages. Specifically in my case, the "Manage Posts" and "Manage Pages" pages. I saw people on the coding sites asking how to do it, with no one responding to them, and I was unable to really come up with a simple example by doing a little Google-Fu, so I figured it out on my own and thought I'd share.
All you really need to do is shuffle around the $defaults variable (which is an array). Here's the code:
global $defaults; $defaults['cb'] = '<input type="checkbox" />'; $defaults['thumbnail'] = __('Thumbnail'); $defaults['title'] = __('Title'); $defaults['author'] = __('Author'); $defaults['categories'] = __('Categories'); $defaults['tags'] = __('Tags'); $defaults['comments'] = '<span class="vers"><span class="comment-grey-bubble" title="Comments"></span></span>'; $defaults['date'] = __('Date'); $defaults['hits'] = __('Hits'); $defaults['wherego'] = __('Where Go'); return $defaults;
And that's it.
This particular code is what I created for the Manage Posts/Pages editor, when I added image thumbnails to them.
If you're already at this point you're most likely adept enough at understanding PHP and exactly what the above code is doing, so no need for a full explanation.
One tip though: You can play around all you want with it and if you want the columns to go back to the default locations you can simply comment out the "global $defaults;" line, and the normal columns will be in their original places. If you added any custom columns they'll fall into place near the end.
Recent comments
9 weeks 4 days ago
10 weeks 1 day ago
14 weeks 6 days ago
14 weeks 6 days ago
23 weeks 6 days ago
42 weeks 5 days ago
43 weeks 1 day ago
43 weeks 1 day ago
1 year 31 weeks ago
1 year 31 weeks ago