I'm currently setting up events in the Events Calendar plugin and need to create a (supposedly) simple list.
The list should show those details:
- a "category header" showing the title, description and cost of the first event from that category (since those details are the same for all of the events within the same category)
- all events from that category sorted by date
I tried achieving this by using this code on a page template: https://gist.github.com/herrherrmann/1bf98addf711fcb4d2d9
The problem: the "category header" does not fit to the event list, instead it shows the data from the previous loop. Example:
all events from 1st category
title: title from 1st category
description: description from 1st category
cost: cost from 1st category
all events from 2nd category
I understand that I'm using the get_posts function in a wrong way and maybe I have to use two loops in order to get what I need? But I currently can't think of a pattern that outputs it correctly.
Any help is greatly appreciated!