Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I have set a custom post type with some custom fields, one of the custom fields is a date field which is different from the publish date of the post itself, which is by default used by WordPress to sort the posts.

I would like posts on this screen to be by default sorted using the custom field. How can I do that, is there some filter?

Secondly, I would also like to have a dropdown at the top of the page, so a user can filter posts by custom field.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Adding Columns to Admin

To answer your first question, I recommend a plugin called Codepress Admin Columns. This is by far one of the easier and non-coding ways to implement columns. But it will set you back 15EUR to purchase the add-on that allows sorting.

If you wish to get your hands dirty with code then this post by tzeldin88 will help you get started.

Filter Posts from Dropdown

I do not know of any plugins that do this and have not found any in my search. But you could code your own with a little help. First, there are two approaches to this, a form or using javascript. (actually they are both the same, but using javascript makes everything flow together) I dont have time right now to find the best tutorial for you but if you search "wordpress drop down to filter post" then you should have no problem coming up with some reading.

I will update when I get back with some articles that I do find pertinent.

share|improve this answer
    
Thanks, I'm looking for code snippets rather than plugins as I'd like to incorporate this into my plugin. –  drtanz Aug 25 '12 at 12:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.