0
votes

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, exactly 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. ~

2
Could you check again? This exact code does display grand child categories for me.Dogbert

2 Answers

0
votes

And yes this works, thanks Dogbert, however the reason why this didn't work for me the first time is this:

http://wordpress.org/support/topic/child-category-missing-from-admin-list-but-its-there

After going to phpmyadmin, and playing with fix table a bit, it works again in the admin menu, and on the page... Annoying bug here, and no real solution?! :(

0
votes
<?php 
    wp_list_categories( array(
   'child_of'            => 135, //your category id
        'current_category'    => 0,
        'depth'               => 0,
        'echo'                => 1,
        'hide_empty'          => 1,
        'hide_title_if_empty' => false,
        'hierarchical'        => true,
        'order'               => 'DESC',
        'orderby'             => 'count',
        'show_count'          => 0,
        'show_option_none'    => __( 'No categories' ),
        'style'               => 'list',
        'taxonomy'            => 'category',
        'title_li'            => 0,
        'use_desc_for_title'  => 0,
    ) ); 
?>