Forums

Listing subcategories under categories (6 posts)

  1. AndrewKantor
    Member
    Posted 1 year ago #

    Hey, all -- hope someone can help with this. I bet it's simple, but I can't find the answer.

    My blog has several main categories, most with three or more subcategories.

    On my home page, I'd like to display the name of each main category (say, with a big, bold font), and then each of its subcategories underneath (say, as a ul). The result would look kinda like the old Harvard outlines.

    I see how to list all the categories, and all the parents, but not how to group the subs under their parents.

    If anyone can point me in the right direction, I'd appreciate it. Thanks!

    Andrew

  2. moshu
    Member
    Posted 1 year ago #

    That's usually a theme issue: use the proper parameter (hierarchical=1) in the template tag and style it as you wish. Note: WP creates nested list in this case, you just need to write the proper style declarations.

    Template_Tags/wp_list_categories

  3. AndrewKantor
    Member
    Posted 1 year ago #

    Ahhhhh. I see what I was missing. The theme I used had the styles for UL and LI being almost identical, so I couldn't see the fact that this was doing what I wanted.

    Thanks for your help!

  4. AndrewKantor
    Member
    Posted 1 year ago #

    All right -- it's almost right. What I can't seem to do is set the style for the main category to be different than the style for the child categories.

    I'm trying to make the main categories big and bold, with the subcats beneath them having bullet points. What I get is both having bullets and any changes I make to the CSS are reflected in both.

    Is there a way I can get the cats and subcats to be handled differently?

    Thanks!

  5. moshu
    Member
    Posted 1 year ago #

    Yes you can. Click on my name here and see the "Sections" in the far right sidebar. Those are categories and subcats.

  6. AndrewKantor
    Member
    Posted 1 year ago #

    I see -- that's exactly it. But I can't figure out how you're doing it. (Rather, why it isn't working for me.)

    * * *

    Correction: I got it working. It seems that even though the ULs and LIs are within a DIV, they are still getting their formatting from the overall UL and LI styles. So I kept changing (in my case) "#left ul" and "#left li" to no avail. Once I fixed the general ul and li style, though, it worked.

    It doesn't make sense to me, but heck, it's working. Thanks for taking the time to help!

Topic Closed

This topic has been closed to new replies.

About this Topic