Return to Snippet

Revision: 13159
at April 12, 2009 04:56 by hussong


Initial Code
<?php if (is_category('26')) { $posts = query_posts($query_string. '&orderby=meta_value&meta_key=date&order=DESC' ); } ?>

Initial URL


Initial Description
Put this before the loop in archive.php to have posts in the archive for category '26' sorted by custom field 'date'. 
Assign sortable values like '090501' or '2009-05-01' to those fields when editing posts and your Upcoming Events will be sorted by the future date at which they will take place.

Initial Title
Wordpress: Sort Order by Custom Field for specific Category

Initial Tags
php, sort, template, wordpress, order

Initial Language
PHP