Support » Plugins » Hacks » wp_list categories doesnt display sub categories ?

  • here is the code.

    http://pastebin.com/4WguxZb2

    The $PozGetThat veriable mean Artists main categorie’s sub categories

    how can i display only Artists sub categories sub categories ?

    the category hierarchy is like

    Artists
    -A
    -B
    -C

    -J
    –Jessie J
    -K

    _Z

    I just want to display Artists name of sub categories . Please help about this. thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • it will definitively not work with http://codex.wordpress.org/Template_Tags/wp_list_categories

    possibly try to build something using http://codex.wordpress.org/Function_Reference/get_categories

    rough example:

    <?php $artist_cat = get_term_by('name','Artists','category');
    if( $artist_cat ) {
    	echo "\n".'<ul class="category-list">';
    	foreach( get_categories( array('parent' => $artist_cat->term_id ) ) as $sub_cat ) {
    		if( $sub_cat ) foreach( get_categories( array('parent' => $sub_cat->term_id ) ) as $sub_sub_cat ) {
    			if( $sub_sub_cat ) echo "\n".'<li><a href="'.get_category_link( $sub_sub_cat->term_id ).'" title="link to '.esc_attr($sub_sub_cat->name).'">'.$sub_sub_cat->name.'</a></li>';
    		}
    	}
    echo "\n".'</ul>';
    } ?>

    http://codex.wordpress.org/Function_Reference/get_term_by
    http://codex.wordpress.org/Function_Reference/get_category_link

    Thread Starter Fatih Toprak

    (@fatih-toprak)

    Great thanks a lot @alchymyth.

    This worked but i asked a wrong question.

    The hierarchy must be like

    Singer
    -Artists
    –A
    –B
    –C

    –J
    —Jessie J
    –K

    –Z

    Colud you give me an exam please. ?

    Thread Starter Fatih Toprak

    (@fatih-toprak)

    Also,

    <ul>
    <?php
    $Who = 69;
    wp_list_categories ('title_li=0&child_of='.$Who.'&hide_empty=0&style=list&show_count=1&orderby=count&order=desc&number=10'); ?>
    </ul>

    i can write all letter’s cat id, but in that example when i wrote one id number this work.

    but how can i write the second one ?

    like

    $Who = ‘69,70,71’

    is that possible?

    ‘child_of’ only accepts one single integer id.

    The hierarchy must be like

    i.e. is ‘Singer’ the top category, and you want the whole hierarchical list?

    if you want to show all children (und grandchildren and …) of ‘Artists’ as unordered list, try:

    <ul>
    <?php $artist_cat = get_term_by('name','Artists','category');
    wp_list_categories('title_li=&child_of='.$artists_cat); ?>
    </ul>
    Thread Starter Fatih Toprak

    (@fatih-toprak)

    just want to display grandchildren

    Thread Starter Fatih Toprak

    (@fatih-toprak)

    actually i added my category hierachie (screenshot)

    View post on imgur.com

    i want to list most popular 10 artist ( count by lyrics )
    i guess you call that kinf of categories grandchildren ?

    i want to list most popular 10 artist ( count by lyrics )

    you lost me – I am confused about what you want to show.

    can you explain in more detail what categories you want to show?
    what is the connections between Artists and Lyrics?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_list categories doesnt display sub categories ?’ is closed to new replies.