Support » Plugin: Categories Images » Sub categories

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Muhammad

    (@elzahlan)

    Sorry for my late reply.

    You can display post categories using the 1st loop example in the plugin docs with get_the_category()

    No worries, thanks for the reply, but I don’t think you’ve answered my questions, it’s about displaying images for sub-categories, can you provide a code example?

    Plugin Author Muhammad

    (@elzahlan)

    🙂
    ok
    assume you are in a single post, all you have to do is to get this post categories using get_the_category() then loop on it to display categories images, for example:

    <ul>
     <?php foreach (get_the_category() as $cat) : ?>
     <li>
     <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
     <a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a>
     </li>
     <?php endforeach; ?>
    </ul>

    Hope I helped.

    Thanks I will test when I get a chance, however the project I needed it for finished ages ago so I had went with a different solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sub categories’ is closed to new replies.