Trying to translate Kafkaesqui
-
All I want is the parent category id for use with children. Here’s what Kafkaesqui wrote a few months back
<?php $cat_object = $wp_query->get_queried_object(); $cat_parent = $cat_object->category_parent; ?>
but then what do I do with that? I tried to echo &cat_parent but that did nothing – doesn’t seem to matter whether I’m in or out of the loop
this didn’t work either
$cat = get_the_category(); if ($cat->cat_parent = 0) { $cat_parent = $cat->cat_ID; } else { $cat_parent = $cat->cat_parent; } echo $cat_parent;
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Trying to translate Kafkaesqui’ is closed to new replies.