Support » Fixing WordPress » Show only the subcategories the current post or cat is listed in?

  • I realized I placed this in the wrong forum, so here it is, in the correct one:

    I’m currently trying to work out how to get this work. What I want is that subcategories are only shown in categories that the current page, post or category is related to. For example:

    CAT1
    CAT2
    CAT3
    -SUBCAT1
    -SUBCAT2
    –SUBCAT2.1
    –SUBCAT2.2 (active category)
    –SUBCAT2.3
    -SUBCAT3
    CAT4
    CAT5

    I found a piece of code that works for categories.. but It doesn’t show anything on a post. I’m sure it’s not hard to fix but I’m not too good at this :). Is there anyone who can help me with this?

    Here you can find the php code:
    http://pastebin.com/ehKksQJ9

    Code in sidebar.php
    <?= get_mymenu($wp_query->query_vars[‘cat’]);?>

  • The topic ‘Show only the subcategories the current post or cat is listed in?’ is closed to new replies.