I have many publications (posts) and I want them to be showed chronologically: 2022, 2021, 2020, …. And within each year I want to posts be sorted by title. I use PHP so I want to know if there’s a simple loop (I’m not an expert on backend/PHP) to be created. Base that I’m using looks like this:
​
`<?php`
`$args = array(`
`’post_type’ => ‘publications’,`
`’post_status’ => ‘publish’,`
`’posts_per_page’ => -1,`
`);`
`$loop = new WP_Query( $args );`
`while ( $loop->have_posts() ) : $loop->the_post();`
`the_content();`
`endwhile;`
`wp_reset_postdata();`
`?>`

In your $args array, add a orderby array.
$args = array(
‘post_type’ => ‘publications’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1,
‘orderby’ => array(
‘title’ => ‘ASC’,
‘date’ => ‘DESC’
)
);