WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to get current category displayed? (3 posts)

  1. darrepac
    Member
    Posted 8 years ago #

    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

  2. darrepac
    Member
    Posted 8 years ago #

    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...

  3. darrepac
    Member
    Posted 8 years ago #

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

      <?php wp_list_cats("optioncount=1&child_of=$cat->category_parent"); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.