views:

40

answers:

2

hello,

can you help me, how can i sort posts by some custom field, in wordpress 3?

do i need to create some custom fields, and add new field in db, or...?

tnx in adv!

A: 

No you do not have to create custom fields.

You can use a plug-in like this: http://wordpress.org/extend/plugins/wp-post-sorting/

or do it by editing your category file: http://codex.wordpress.org/Alphabetizing_Posts

Todd Moses
i think i was not enough clear with my question... i think that i need some custom filed, like "sort order", which can help me to define position of my post. because i want to sort it by my custom criteria...
A: 

You can use query_posts to sort posts by custom fields (also referred to as meta key value pairs). Assuming you just want to add the sorting to the current view's query, you can do something like this:

global $query_string;
query_posts($query_string . '&meta_key=foo&orderby=meta_value'); 
Richard M