[resolved] Show subcategories of current category (3 posts)

  1. Jimi Wikman
    Posted 6 years ago #

    Ok, I am having no luck finding a solution for this, so maybe you can help me solve it.

    I am setting up a directorystyle FAQ database and I am tryiong to figure out how to display subcategories of the current category.

    I can list the categories through <?php wp_list_categories('&title_li=&show_count=1&child_of=1'); ?>

    But I would like to be able to dynamicly replace child_of=x so that the x is the number of the category currently visited. So if I am clicking through to category with the ID of say...47 the code should change to child_of=47 automaticly.

    Any help would be much appreciated.

  2. MichaelH
    Posted 6 years ago #

    if ( is_category() ) {
      $current_cat = get_query_var('cat');
  3. Jimi Wikman
    Posted 6 years ago #

    Thanks Michael, that works perfectly!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.