Support » Themes and Templates » How to get current category displayed?

  • Resolved darrepac

    (@darrepac)


    Hello,

    I try to display a list of category child of a parent category in the sidebar.
    So I need to put a value there :
    wp_list_cats(‘optioncount=1&child_of=$parent_cat_id’)
    How to retrieve such value? I have searched on the forum found some info for displaying child of pages but nothing seems to do the trick for category listing

    thanks
    Pascal

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forgot to mention that I have tried :
    <?php $cat = get_the_category(); $cat = $cat[0]; ?>

      <?php wp_list_cats(‘optioncount=1&child_of=$cat->cat_ID’); ?>

    without success…

    Succeed with :
    <?php $cat = get_the_category(); $cat = $cat[0]; ?>

      <?php wp_list_cats(“optioncount=1&child_of=$cat->category_parent”); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get current category displayed?’ is closed to new replies.