Orderby nesting (3 posts)

  1. canon2k9
    Posted 6 years ago #

    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.

    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.

  2. canon2k9
    Posted 6 years ago #

    Any help would be appreciated. I have read of SQL quieries with multiple ORDER BY statements, but am unable to edit one to work with WordPress. Further, I am under an impression that an array may work, though cannot forge one to work either. Again, any help would be appreciated.

  3. Decio
    Posted 6 years ago #

    Have you found an answer? I´m having a similiar problem.

Topic Closed

This topic has been closed to new replies.

About this Topic