Display Post of Child Category only
-
Hi,
I have been scratching my head for a while and can’t seem to find the right information, not sure I am doing this right.
I have a the following categories
– Country A
–City A
—Hotels in city A
—-Hotel type 1
—-Hotel type 2
etc….City is a Post.
When in City, I like to display Hotel Type 1, Hotel type 2 as a listingTo get the right category ID when in city I do
$currentcategory = get_the_category(); $currentcat = $currentcategory[0]->cat_name; $currentcategory_id = get_cat_ID($currentcat);
$currentcategory_id allows me to get the City category ID and then I try to get the child posts of the categories below (hotels)
Then I do a query_posts to list the Hotels for this city
query_posts('child_of='.$currentcategory_id);
Am I complicating it too much?
Help really appreciated.
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Display Post of Child Category only’ is closed to new replies.