Support » Fixing WordPress » Using wp_list_Categories to show only DIRECT children

  • I’m trying to acheive a category sidebar that shows the children of the current category.
    So for example if my cat structure is as follows
    Arts
    – Music
    — Jazz
    — Rock
    – Literature
    — Poetry
    — Prose

    When I am in the arts category page I want only Music, Literature to display in the sidebar
    And when I click on music then Jazz and rock will display.

    I’m currently using wp_list_categories(“title_li=&child_of=$cat”)
    But it lists the sub-sub-categories as well. IS there anyway I can disable that?

Viewing 1 replies (of 1 total)
  • I had a solution here:

    http://wordpress.org/support/topic/82359

    but it relies on deprecated tags, which isn’t great.

    To me, options to show only the children and siblings of current categories should be available in the core (correctly embedded in a list showing the parents

    e.g.
    A
    B
    C
    (-Ca) <–not shown
    -Cb
    –Cbi <—-current
    —Cbi1 <–children (first generation only)
    ( —-Chi1a ) <– not shown
    —Cbi2
    –Cbj <—-sibling
    (-Cc) <– not shown
    D
    E

    E.g if viewing Cbi we’d have the options to see this:
    A
    B
    C
    -Cb
    –Cbi <—-current
    —Cbi1
    —Cbi2
    –Cbj
    D
    E

Viewing 1 replies (of 1 total)
  • The topic ‘Using wp_list_Categories to show only DIRECT children’ is closed to new replies.