Link organisation with the Category Overload plugin
I’m also looking after my Club’s site, and have loaded Alex King’s CategoryOverload plugin.
This is cool, as it lets you build a hierarchy of link categories.
I’ve written a custom SQL routine – which I’ve included in one of our pages – to use this for output, by cycling through the different sub-categories of a parent (other links aren’t output).
This works with WordPress 2.1.3.
Feel free to adapt it.
Here’s the skeleton code, for a “parent” category with an ID of 12.
Note that Php commands have an extra space inserted after the “< " to prevent accidental execution.
This first bit builds a array of sub-categories :-
$querystr = "
SELECT cat_id, cat_name
FROM `wp_categories`
WHERE category_parent =12
order by cat_id
";
$linkcats = $wpdb->get_results($querystr, OBJECT); ?>
… Then this part loops through each subcategory and outputs it.
(you may want to put some formatting in …)
<?php foreach ($linkcats as $linkcat): ?>
<?php echo $linkcat->cat_name ; ?>
<?php get_links( $linkcat->cat_id, ”, ”, ”, TRUE, ‘category’, TRUE, FALSE, -1, FALSE, TRUE); ?>
<?php endforeach; ?>
<?php endif; ?>
Entries RSS