Strange loop problem when showing most recent post in category
-
I’m currently making a website, and want to have a page which shows the most recent post from its subcategories.
For example…
News -> Entertainment -> Movies -> The Terminator (1984)
News -> Entertainment -> Music -> The Beatles‘The Terminator’ and ‘The Beatles’ might have 10+ news items each, but I only want the page to show the most recent one for each.
I’m bad at coding, so this probably looks like hell to some people, but here’s how I’ve been doing it:
(Category 10 is “News”, i.e. the topmost category.)
[Code moderated as per the Forum Rules. Please use the pastebin]
This works great. I have 13 posts across 4 categories, and I see only the most recent post in each of those 4 categories.
The problem lies when I add a fifth category. If there is one post in the fifth category, it shows fine. If there are two or more, it ONLY shows the most recent most from the fifth category and hides the other 4 categories’ posts which were displaying fine until then.
I can’t seem to figure this one out. Any ideas?
- The topic ‘Strange loop problem when showing most recent post in category’ is closed to new replies.