In this image,
1. The Black letters are default post titles
2. The number before the ‘of‘ is a custom field.
3. The number after the year is the post’s published year
Now I want to sort this according to title’s alphabetical order. So it will be,
C, D, D, L in this case.
At the same time I want it to be sorted by yearly. So all the posts start in ‘D’ should be sorted by post year.
Also the number’s that come before the ‘of‘ should be sorted in ascending order within that year.
The below code chunk didn’t work
$args = array(
'posts_per_page' => 30,
'category__in' => $idObj,
'paged' => $paged,
'meta_query' => array(
'relation' => 'AND',
'custom_key' => array(
'key' =>
'original_act_ordinance_information_0_act_ordinance_number',
'compare' => 'EXISTS',
'type' => 'NUMERIC',
),
),
'orderby' => array(
'title' => 'ASC',
'post_date' => 'DESC',
'custom_key' => 'ASC',
),
);
Where am I making the mistake?
and is there any solutions to achieve this?
EDIT:
So basically I want this…
So this image is sorted alphabetically, at the same time all the posts should be sorted from latest year to the oldest, meanwhile let’s say there are multiple posts in the same year. IE: 16 of 2016, 23 of 2016 and 18 of 2016. I want them to be ordered in ascending order.
In conclusion, I want the posts to be ordered,
-
Alphabetically
-
(Within alphabetically ordered) Yearly
-
(Within yearly ordered) Numerically
At the same time.
In a peaceful world the sorted posts should look like this