Trouble incorporating taxonomy images into existing code
-
I’m currently trying to list all child categories on a parent level category, with a depth of 1, and the same as you go down a level, until you get to the final sub category in the chain.
I have this code working, but I desperately need to get the images I have set using your (awesome!) plugin. I’m pretty new to php so am struggling some what – can anyone give any help in how to alter this to achieve my desired result?
<?php global $ancestor; // Declare global ancestor variable ?> <?php foreach ($categories as $cat) { if ($cat->cat_ID != 1) { // If category is not uncategorized ... if (cat_is_ancestor_of($ancestor, intval($cat->cat_ID)) == false) { // .. and if the previous category in the loop wasn't the ancestor of this one ... ?> <h2><a href="<?php echo get_category_link($cat->cat_ID); ?>"><?php echo ($cat->cat_name); ?></a></h2> <?php echo ( category_description($cat->cat_ID) ); ?> <?php print apply_filters( 'taxonomy-images-queried-term-image', '' ); ?> <?php $ancestor = intval($cat->cat_ID); }; // make this category the new ancestor }; }; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Trouble incorporating taxonomy images into existing code’ is closed to new replies.