WordPress.org

Support

Support » WP-Advanced » Display sub cat when u select a cat

Display sub cat when u select a cat

  • Hi
    I have searched for this endlessly and really need some help, like many others.

    I have Subcategories within my Categories,respecting a hierarchy,
    exemple :
    ==========
    Mcategory
    -MSubcat1
    –Subcat1
    –Subcat2
    –Subcat3

    -MSubcat2
    –Subcat1
    –Subcat2
    –Subcat3
    ==========

    when i select Mcategory I want to display
    -MSubcat1
    -MSubcat2 only without posts

    and when i select for exemple -MSubcat2

    I want to display only
    –Subcat1
    –Subcat2
    –Subcat3 without posts

    the post will be show only in Subcat not in MSub on Mcategory

    And all thi will be displayed on the home page but not in the sidebar

    All my thanks

Viewing 1 replies (of 1 total)
  • If you mean category archives,
    create category.php file and edit like below:

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

Viewing 1 replies (of 1 total)
  • The topic ‘Display sub cat when u select a cat’ is closed to new replies.