Multiple criteria in one loop
-
Hi,
I have posts in a category that contain the word Season 1, Season 2, Season 3 etc. And some categories go up to Season 30. I want to write a loop which detects the highest season number and will then display the results sorted by season.
This is what I have so far:
[code moderated - for any code longer than 10 lines, please use the https://pastebin.com/ - see https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]
$catymeta is the category number of the posts that need to be displayed. It is set using a custom field.
The only problem with this is that I would have to repeat the code to display Season 2+ and if a category doesnt have any posts with the word Season 2 in the title the Season 1 and
- will remain there.
So really what I want is to run a query that outputs like this and that goes to the highest season number...
Season 1
- Season 1 Episode 1
- Season 1 Episode 2
- Season 1 Episode 3
season 2
- Season 2 Episode 1
- Season 2 Episode 2
- Season 2 Episode 3
I hope I am making myself clear. Any help is greatly appreciated.
Thanks
- The topic ‘Multiple criteria in one loop’ is closed to new replies.