Support » Fixing WordPress » Archive page showing posts in category tree

  • Hi all,

    In my archive page, I want to show the posts in a the category hierarchy under a given main category. Let’s say I have a category called “My Blog”. I want the archive page to show just the categories under “My Blog” I don’t want the categories to be hyperlinks.

    My Blog Archive

    Topic 1
    – _Post 1_
    – Subtopic 1a
    – – _Post 2_
    – – _Post 3_
    – Subtopic 1b
    – – _Post 4_
    – – _post 5_
    Topic 2
    – Subtopic 2a
    – – _Post 6_

    The dashes are here only to show indentation and won’t appear on the archive page. The underscores represent hyperlinks.

    I’ve tried googling for an an example. I’ve seen how to use a single command to return the a category tree. But, I have found and example show how to include post titles in the tree.

    I’ve got a working knowledge of PHP and I am working on understanding The Loop. Nesting query loops still has me a little confused. It seems this task needs to be recursive.

    Pseudo code:

    function show_cat_posts(category)
    while (have_posts(category)) {
    Print postTitle;
    while (have_sub_categories(category)) {
    Print subCategory;

    Of course, the needed nested ordered lists HTML code will need to be generated. I know how to do that.

    A link showing how to do the queries would be sufficient. Any help will be appreciated.


Viewing 1 replies (of 1 total)
  • Steven,
    I was wondering if you ever figured out how to accomplish this? I’m looking to do the same thing on my site.


Viewing 1 replies (of 1 total)
  • The topic ‘Archive page showing posts in category tree’ is closed to new replies.