Links Category no apparent order, ID or name.
-
I have the following code in my sidebar to display my links.
<?php
$link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);
foreach ($link_cats as $link_cat) {
$num_links = $wpdb->get_var(“SELECT count(*) FROM $wpdb->links WHERE link_category = $link_cat->cat_id”);
if ($num_links > 0):
?>
<li id=”linkcat-<?php echo $link_cat->cat_id; ?>”><div class=”title”><?php echo $link_cat->cat_name; ?></div>-
<?php wp_get_links($link_cat->cat_id); ?>
<?php endif; } ?>
Taken off this site as I wish to list links by category and want to be able to control the appearance of the Category names as opposed to the default <h2> tag.
However whn I go to my blog the categories are listed in the following order…
ID nos…
1, 15, 12, 13, 14First letters….
B, S, O, R, NOrder added….
1, 5, 2, 3, 4All I want to do is have a list of Categories in ID order, (ie order created) showing all the links in the category, and have control over the format of the category heading.
What have I done wrong.
Also, adding spaces appears not to work, I think it’s something to do with Firefox and the way it renders, but I really want to know how to put my list up by ID, or by name.
- The topic ‘Links Category no apparent order, ID or name.’ is closed to new replies.