• Resolved lasthope

    (@lasthope)


    hi,
    i want to show sub cats were member is showing main cat

    for example :

    when member go to learning cat , display sub cats of learning and when going to blog ,showing the sub categories of blog …

    please help me ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • when member go to learning cat

    assuming you mean the category archive page for ‘learning’:

    do you want to show a list of clickable links to the sub cats?

    if yes:

    <ul>
    <?php wp_list_categories('child_of=' . get_query_var( 'cat' ) ); ?>
    </ul>

    https://codex.www.ads-software.com/Template_Tags/wp_list_categories

    you will possibly need to edit category.php in a child theme.

    if you want anything else, please specifiy in more detail.

    Thread Starter lasthope

    (@lasthope)

    thank you

      <?php wp_list_categories(‘child_of=’ . get_query_var( ‘cat’ ) ); ?>

    bu two notes :

    1 – this show “categories” title , how to hide ?
    2 – in categories its working fine , for example :
    i go to website.com/learning , showing {cpanel,whm,whmcs , …}
    but when click on a post of this category , category box is destruct …

    You can give an email address do I send the screenshot?

    Thread Starter lasthope

    (@lasthope)

    i using this code :

    <?php $this_cat = (get_query_var('cat')) ? get_query_var('cat') : 1; ?>
    <?php $this_category = get_category($this_cat);
    if ( $this_category->parent ) { $this_cat = $this_category->parent; } ?>
    <?php wp_list_categories('child_of=' . $this_cat . ''); ?>

    from this topic :
    https://www.ads-software.com/support/topic/list-child-categories-of-current-category-page?replies=6

    and working fine ??
    thank you <3

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get sub cats’ is closed to new replies.