Looking to Sort Custom Fields by Meta Data Values
-
I wanted to keep track of each concert I post about, so I created some custom fields for my blog (using the Custom Field Template Plugin) that show up at the bottom each time I create a post. Those fields are: band name, day, month, year, venue, etc. Using those custom fields I created a new page (with a new calendar.php page template) called “Upcoming Show Calendar” that lives over here. The page works fine except the events are not ordered chronologically, I would like to sort them by the custom field values of “day”, “month” and “year”. Any ideas how I might do that? Right now the page meta data is being retrieved by this query_posts:
query_posts('meta_key=band%20name&order=DESC');
I want to do something like this (pseudocode):
query_posts('meta_key=band%20name&order=meta_value:year&meta_value:month&meta_value:day');
I know that syntax is wrong, but is there any way to do it? Do I need to use a wp_query rather than query_posts?
- The topic ‘Looking to Sort Custom Fields by Meta Data Values’ is closed to new replies.