WordPress.org

Ready to get started?Download WordPress

Forums

Help with Category Archive Display (4 posts)

  1. nfb02001
    Member
    Posted 6 years ago #

    I'm trying to create a new category archive display that shows posts hierarchically (basically only have posts show up in the original category selected, not all the levels above). If I click on a top level category page I want to see:
    Top Level Category
    - Posts only in top level
    Subcat 1
    - Posts only in Subcat 1 (though if they're cross posted with another category in the same level of hierarchy, I want them to show up there as well)
    - Post in Subcat 1, Subcat 2
    Subcat 1 subcat
    - Posts only in subcat 1 subcat
    Subcat 2
    - Posts only in subcat
    - Posts in subcat 1, subcat 2
    (Note: These should also tab in at the appropriate levels to help visually indicate a difference, but I can't seem to make it do it here)
    Does that make sense? I only want to see duplicate posts if a post is categorized into 2 categories, but I want things to display in a hierarchical manner.

  2. nfb02001
    Member
    Posted 6 years ago #

    In looking around more and thinking about this further it's like I need to have an archive page that recursively shows all category archives for parent & child categories, and also uses a function to remove child posts from parent categories.

    I've found a function that will remove the child posts - now I just need to figure out how to show all the subcategory sections - can someone point me in the right direction?

  3. kohaku
    Member
    Posted 6 years ago #

    <?php wp_list_categories('title_li='); ?>

    Or you could take a look at the Codex:

    http://codex.wordpress.org/Template_Tags/get_category_parents
    http://codex.wordpress.org/Template_Tags/wp_list_categories

  4. nfb02001
    Member
    Posted 6 years ago #

    I've looked at that. The trick is that I want it to display the posts from first the parent category, then (on the same page, just formatted to indicated they're subtopics) the children posts.

    I'm sure it's that I need to have multiple loops, I'm just not sure how to phrase them.

Topic Closed

This topic has been closed to new replies.

About this Topic