I'm working on displaying a series of child categories in the meta of each post. For instance, after the post appears an array, depending on category selection, describing the post content:
Color: Red | Shape: Circle | etc.
The following code displays the content as desires except not in the correct order. The display currently appears as alpha order of the child categories.
I need to either order the categories by parent ID or in the order their presented in the code.
Any ideas?
<span class="cat-links">
<?php
foreach((get_the_category('orderby=ID&order=ASC')) as $childcat) {
if (cat_is_ancestor_of(3, $childcat)) {
echo 'Color: '. '<a href="'.get_category_link($childcat->cat_ID).'">';
echo $childcat->cat_name . '</a> | ';
}
if (cat_is_ancestor_of(10, $childcat)) {
echo 'Shape: '. '<a href="'.get_category_link($childcat->cat_ID).'">';
echo $childcat->cat_name . '</a> | ';
}
}
?>
</span>

var_dumpof the inputs of yourforeachloop and link to a pastebin. – kaiser Feb 3 '12 at 6:49