开发者

Wordpress - custom sort order

开发者 https://www.devze.com 2023-01-17 03:52 出处:网络
can you help me, how can i sort posts by some custom field, in wordpress 3? do i need to cre开发者_运维问答ate some custom fields, and add new field in db, or...?

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

do i need to cre开发者_运维问答ate some custom fields, and add new field in db, or...?

tnx in adv!


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'); 


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

0

精彩评论

暂无评论...
验证码 换一张
取 消