Ok, here’s the scenario. I’m using WordPress as a directory database. I have this category structure
– The Directory (grand parent)
— City (parent)
— Hotels (child)
— Attractions (child)
— Restaurants (child)
I’m viewing a single post ‘hotel california’ which resides in the ‘hotels’ category and has the parent ‘city’.
I would like to display 5 random posts from the parent ‘city’ but only including the child categories ‘restaurants’ and ‘attractions’ and excluding the current category of ‘hotels’ as sort of a “what’s nearby” feature, yet excluding establishments of the same category like another hotel.
I’ve done quite a bit of searching and have been successful pulling posts from the parent category, but I can’t figure a way to exclude the current category.
- The topic ‘Related posts using parent and sub categories’ is closed to new replies.