Combine multiple separate lists into one

I have a custom query for my taxonomy of:

$terms = get_terms(
array(
‘taxonomy’ => “issueCompanion”,
‘hide_empty’ => false,
‘fields’=>’all’
)
)

which returns an array of publications (think along the lines of monthly magazines). I have an advanced custom field on the taxonomy by the name of published_year in which the user types a string of the year the magazine was published in.

In order to get the year on each taxonomy, I run this code within a for loop:

$year = get_field(‘published_year’, $term)

I’m having trouble combining the two different requests into one loop without one thing or another showing up several times.

I need to create a single page in which I am showing the year, and then list all publications that match that year, like so:

2019
Publication xxx
Publication xxx
2018
Publication xxx
etc.

I would be most grateful for any input that helps me combine the two into one.

Read more here:: Combine multiple separate lists into one

Leave a Reply

Your email address will not be published. Required fields are marked *