• Resolved genusone

    (@genusone)


    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 http://pastebin.com/ - see http://codex.wordpress.org/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

    1. Season 1 Episode 1
    2. Season 1 Episode 2
    3. Season 1 Episode 3

    season 2

    1. Season 2 Episode 1
    2. Season 2 Episode 2
    3. Season 2 Episode 3

    I hope I am making myself clear. Any help is greatly appreciated.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple criteria in one loop’ is closed to new replies.