category_parent != 0) { $walkCat = $thisCat; $ancestryCount=0; while ($walkCat->category_parent != 0) { $ancestry[$ancestryCount] = $walkCat->category_nicename; $walkCat = get_category($walkCat->category_parent); $ancestryCount++; } $rootParent = $walkCat->category_nicename; //we *should* be doing the below, but since we already worked around later, it causes issues. Clean this up someday :) //if (!preg_match('|/$|',$rootParent)) { // $rootParent .= '/'; // print "meh"; //} $ancestry[$ancestryCount] = $rootParent; } $listOfPages = wp_list_pages('title_li=&echo=0&depth=1'); preg_match_all('|a href="([^"]+)|',$listOfPages, $usedPageLinks); preg_match_all('|>([^<]+)|',$listOfPages, $usedPageNames); $countPages=0; while ($usedPageLinks[1][$countPages]) { $tempPageLink = $usedPageLinks[1][$countPages]; $tempPageName = $usedPageNames[1][$countPages]; $tempPageLink = preg_replace("|$pathToHome|i",'',$tempPageLink); $tempPageLink = preg_replace('|^/|','',$tempPageLink); $pageNamesBySlug[$tempPageLink] = $tempPageName; // now we have a list of the parent pages $countPages++; } $pathToCategories = get_category_link(9897); //this will fail if you actually have category #9897 ... $listOfCats = wp_dropdown_categories('echo=0&exclude=1, 2, 7&orderby=name'); preg_match_all('/value="(\d+)">/',$listOfCats, $usedCatIDs); preg_match_all('|">([^<]+)|',$listOfCats, $usedCatNames); $countcat=0; while ($usedCatIDs[1][$countcat]) { $tempCatID = $usedCatIDs[1][$countcat]; $tempCatLink = get_category_link($tempCatID); $tempCatName = $usedCatNames[1][$countcat]; $tempCatLink = preg_replace("|$pathToCategories|i",'',$tempCatLink); if ($pageNamesBySlug[$tempCatLink]) { $parentPages[$tempCatLink] = $tempCatName; $parentPageIDs[$tempCatLink] = $tempCatID; $parentPagesOrderBy[$countcat] = $tempCatLink; } else { $childPages[$tempCatLink] = $tempCatName; //put the children into their own storage tank preg_match_all('|^[^/]+|',$tempCatLink, $thisChildParent); $cppc=0; while ($childPagesParents[$thisChildParent[0][0] . '/'][$cppc]) { $cppc++; } $childPagesParents[$thisChildParent[0][0] . '/'][$cppc] = $tempCatLink; } $countcat++; } foreach ($parentPagesOrderBy as $ppob) { echo '
  • ' . $parentPages[$ppob] . ''; if (($rootParent . '/' == $ppob) || ((!$rootParent) && ($parentPageIDs[$ppob] == $current_categoryID))) { //we're at in our current category or its root parent if ($rootParent . '/' == $ppob) { //oh, we must be a child. first we show our ancestry, working backwords: $pathToChild = $pathToHome . '/' . $ppob; $pathToChild = preg_replace('|/$|','',$pathToChild); $fullChildName = $ppob; $fullChildName = preg_replace('|/$|','',$fullChildName); $ancestryCount--; //we've just taken care of our root parent, so no need to repeat it. $childCount = $ancestryCount; while ($ancestryCount >= 0) { $pathToChild .= '/' . $ancestry[$ancestryCount]; $fullChildName .= '/' . $ancestry[$ancestryCount]; if (!preg_match('|/$|',$pathToChild)) { //Yeah, we should have fixed this back top (around line 28) $pathToChild .= '/'; } echo "\n" . '
    • ' . $childPages[$fullChildName . '/'] . ''; $ancestryCount--; } } // check for kids. if ($childPagesParents[$ppob]) { $haveAChild=0; $myNiceName = $ppob; foreach ($childPagesParents[$ppob] as $oneChild) { if ($rootParent . '/' == $ppob) { //we're a child, so we need to make sure these aren't siblings, us, uncles, etc. if ($oneChild == $fullChildName . '/') { //if the child is us, then skip it (in case we're a child-parent) continue; } elseif (!preg_match("|^$fullChildName|",$oneChild)) { //it's an aunt, uncle or sibling continue; } $myNiceName = $fullChildName . '/'; } if (preg_match("|^$myNiceName([^\/]+)\/(\w+)|",$oneChild)) { //skip our grandchildren and younger continue; } if (!$haveAChild) { //if this is to be our first child, then create an unordered list echo "
        \n"; } echo '
      • ' . $childPages[$oneChild] . '
      • ' . "\n"; $haveAChild++; } } if (!$haveAChild) { //we've had no kids, so start an unordered list echo "
          \n"; } //then we show category posts: ?>
        = 0) { echo '
      ' . "\n"; $childCount--; } } } //end of showing ancestry & posts echo '
    • ' . "\n"; } ?>

    • Please Donate
    category_nicename == 'uncategorized') {?>