How to query posts that have certain post meta keys, and sort by meta key and/or value
I'm using this structure to make album lists. I'm using a key so I correspond lists to albums but I don't know how to reverse the output so the items start at the top with lowest key value. Any ideas?
?php
$album = get_post_meta($post-ID, "album", false);
$album_list = get_post_meta($post-ID, "album_list", false);
foreach ($album_list as $album_list) {
list($key, $value) = explode(',',$album_list);
$indexed_album_list[$key] = $value;
}
foreach ( $album as $each_album) {
list($key,$album) = explode(',',$each_album);
echo 'div'.$album.'/div';
echo 'div';
if ($album_list = $indexed_album_list[$key]) {
echo $album_list;
}
else {
echo 'nbsp';
}
echo '/div';
}
?
Topic lists custom-field Wordpress
Category Web