Forums
Forums / Fixing WordPress / Detecting Current Category…
(@sithicus)
19 years, 6 months ago
Is there a way to use use:
wp_list_cats(‘child_of=#’)
and inject the current category into # so I do not have to create a million category pages?
I basically have a static left menu but then wanted to show the subcategories for the category page that I am currently on
(@kafkaesqui)
$cat is a global variable that’s hanging around on category queries. So try:
$cat
wp_list_cats("child_of=$cat")
It’s likely you’ll want to list the child categories of a parent *even* when you’re in one of the child category listings. If so, see this post:
http://ww.wp.xz.cn/support/topic/45095#post-471616
The topic ‘Detecting Current Category…’ is closed to new replies.