Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

bradical911 on "Query posts sort by title and a meta key"

$
0
0

Hi,

Im trying to get my loop to sort alphabetically by title (the easy) bit then use the meta_key as a secondary value to sort as many titles are the same word. Ive tried to use the order by to set this but i dont think it works correctly.

$posts = query_posts($query_string . '&meta_key=Variety&orderby=meta_value, title&order=ASC&posts_per_page=20');

So the result shouldn't be

Cat - Red
Cat - Apple

instead

Cat - Apple
Cat - Red


Viewing all articles
Browse latest Browse all 8245

Trending Articles