Categories with Descriptions | No Plugins Needed
This is a little hack that I hobbled together after reading Web Designers Wall and realizing that pulling stuff out of the database in my own little loop shouldn’t be that Bad. This is neither a. Xhtml standards compliant, or b. a good idea so use at your own risk. Sometime in the near future, I will worry about making this site Standards compliant, but I have about 8 things ahead of that project, and every single one of them will either complicate or ease the transition to Xhtml/CSS badge-worthy status.
In case anyone wanted to know how I did my Categories when there is not a wp call for it.
Simple Loop with a few calls:
<ul>
< ?php $category_ids = get_all_category_ids();
$a_length = count($category_ids);
for ( $counter = 0; $counter < $a_length; $counter += 1) {
echo "<li class='cat_sub";
if (is_category($category_ids[$counter])) {
echo " current-cat";
}
echo "'> <a href='";
echo get_category_link($category_ids[$counter]);
echo "'>";
echo get_cat_name($category_ids[$counter]);
echo "<span class='cat_description'>";
echo category_description($category_ids[$counter]);
echo "</span>";
echo "</a>";
}
?>
</ul>
This spits out a nice little segmented piece of Html that I can apply all kinds of fun CSS too and even keeps the handy “current-cat” Class. Comments are coming before the Standards retro-fit, so you can tell me how useless this is very soon.