WordPress.org

Ready to get started?Download WordPress

Forums

Categories hierachy (6 posts)

  1. wp-Guy
    Member
    Posted 6 years ago #

    Hi guys!
    I need to present categories in the sidebar in a hierarchical way. Like this:

    Category 1
    - Sub-category 1
    - Sub-category 2
    
    Category 2
    - Sub-category 3
    - Sub-category 4

    The problem is that only the default theme shows categories like that. All the other themes I have tried show categories in the same level even if they are sub categories. For example:

    Category 1
    Sub-category 1
    Sub-category 2
    Sub-category 3
    Category 2
    Sub-category 4

    How can I make any theme to show categories in a hierarchical way?

    Thanks in advance.

  2. moshu
    Member
    Posted 6 years ago #

    That template tag has a hierarchical (yes/no) parameter. Use it. Although the default is "yes".

  3. Ivovic
    Member
    Posted 6 years ago #

    style your nested ULs in the sidebar.

    for instance:

    ul, li { margin:0; }
    ul ul, ul ul ul { margin-left: 10px; }

    (or do it with the 'li' element instead, up to you :)

    or... you can use the built-in classes

    .children {margin-left: 10px;}

    the children class appears on the UL tag for child categories.

    you probably have a definition which removes all margins from ULs and LIs... but without nesting your definitions, the margins will be removed from all of them (even the children)

  4. wp-Guy
    Member
    Posted 6 years ago #

    Thank you very much, moshu.
    The parameter hierarchy was set to "0" and I changed it to "1".

  5. Ivovic
    Member
    Posted 6 years ago #

    I thought I took the safer bet, to be honest... since I figured something staring at you saying 'hierarchical=0' would tip you off ;)

    *giggles*

  6. SylviaC
    Member
    Posted 5 years ago #

    I am trying to do the same thing with my categories. Where do I find the parameter hierarchy to change it to 1?

Topic Closed

This topic has been closed to new replies.

About this Topic