Hello all,
I am using custom post types to create an event type. I have it all working great but is there a way to change the order they posts are listed in. So for example instead of the timestamp of the post it could be the event start date custom field?
Many thanks in advance.
Dave.
how do you display the CPT?
I'd assume with a query_posts?
You can just add to the query with the orderby and order parameters....
http://codex.wordpress.org/Function_Reference/query_posts#Orderby_Parameters
query_posts( array(
// Set post type
'post_type' => 've_members',
'posts_per_page' => 50,
'orderby' => 'ID',
'order' => 'ASC',
// Enabled paging
'paged'=> ( get_query_var('paged') ? get_query_var('paged') : 1 ),
));
heres an example of mine..... ve_members CPT, 50 per page, by post ID in reverse order
Hello. Thanks for your response.
I didn't make it clear in my first post but I am referring to the admin.
Dave.
thanks for that link. that seem great although as of 3.1 it appears to be built in so might be worth waiting to inherit the core functionality.
lol, yup, if that's the case it would definitely make life easier eh?
Thanks for all your help. I'm gonna leave it to save the hassle when upgrading to 3.1.