Here is the situation. I have posts that I would like sorted in their respective categories. I can get the posts to sort once using the orderby statement, however, need to sort even further.
For example. year, month, and selection number.
add_action('pre_get_posts','sort_categories_by_title');
function sort_categories_by_title($x) {
if(is_category()) {
$x->query_vars['orderby'] = 'meta_value';
$x->query_vars['meta_key'] = 'selection-no';
$x->query_vars['meta_key'] = 'release-month';
$x->query_vars['meta_key'] = 'release-year';
$x->query_vars['order'] = 'asc';
}
}
The result is a single sort by the last item in the list, release-year. I have tried all I could but with no success. Any help would be appreciated.
Incidentally, this code is adapted from a plugin available http://www.mikesmullin.com.