Forums

wp_list_categories with child_of should display grand child too (1 post)

  1. keriati
    Member
    Posted 1 year ago #

    Hi there!

    I got a lot of categories on my page, and made them hierarchical, something like this:

    News
    Fun
    ...
    Somestuff
    - child of somestuff
    - - grandchild of somestuff
    - - 2nd grandchild of somestuff
    - 2nd child of somestuff

    Now i want to create some navigation only for "somestuff" category, that only displays the child and grandchild elements, like this:

    <ul>
      <li>child of somestuff
        <ul>
          <li>grandchild of somestuff</li>
          <li>2nd grandchild of somestuff</li>
        </ul>
      </li>
      <li> ... and so on </li>
    </ul>

    What i tryd first, is this: (135 => somestuff)

    $args = array(
            'show_option_all'   => false,
            'orderby'           => 'name',
            'order'             => 'ASC',
            'style'             => 'list',
            'hierarchical'      => true,
            'title_li'          => false,
            'depth'             => 5,
            'hide_empty'        => false,
            'child_of'          => '135'
            );
    
    wp_list_categories( $args );

    However this won't display the "grand child" elements. I need some help with this.
    ~

Topic Closed

This topic has been closed to new replies.

About this Topic