ThemeShaper Forums » Thematic

Listing Specific Categories of Parent (children, grandchildren, etc.)

(1 post)
  • Started 10 years ago by awarner20
  • This topic is not resolved
  1. I am making category template pages to assign to several categories so I can dynamically create a subcategory listing on each category page. The code below works great, but I have a need to limit this to the first child category of the parent and ignore deeper child categories.

    <?php if (is_category()) {
      $this_category = get_category($cat);
      if (get_category_children($this_category->cat_ID) != "") {
        echo "<h1>Subcategories</h1>";
        echo "<ul>";
    	wp_list_categories('orderby=id&show_count=0&title_li=
    	&use_desc_for_title=1&child_of='.$this_category->cat_ID);
        echo "</ul>";
      }
    }?>

    Additionally I would like to run another loop further down the page that lists the second child categories...and then a third child category listing.

    In other words, I would like to have three separate sections of this category page list the three child level categories in their own groupings. LIke this:

    First Level Child Categories
    **********
    **********
    **********
    Then a paragraph or two, then another listing of categories...

    Second Level Child Categories
    **********
    **********
    **********
    Then a paragraph or two, then another listing of categories...

    Third Level Child Categories
    **********
    **********
    **********

    I hope I'm being clear. Can anyone assist? I tried using depth=1, 2, 3, etc...with no luck.

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.