Wordpress 2.1 And Blogroll
Today I upgraded to a newer version of Wordpress 2.1. And my theme, based on the Dixie Belle theme, showed an error in the sidebar:
-
WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
-
SELECT cat_id, cat_name FROM
After short looking for a solution i discovered, that from the version 2.1 a table called linkcategories does not exist anymore. A code to display links in my template relies on that table.
There is a simple solution:
Replace the following code from the sidebar.php:
-
<?php
-
$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
-
foreach ($link_cats as $link_cat) {
-
?>
-
<ul>
-
<?php wp_get_links($link_cat->cat_id); ?>
-
</ul>
-
</li>
-
<?php } ?>
with the following code:
-
<?php wp_list_bookmarks(); ?>
Yeah, it works… Wait a second, the title of each category (e.g. Blogroll) is not like other headers in the sidebar.
There is an easy way.. the wp_list_bookmarks method accepts some parameters such as title_before, title_after and the theme uses h4 tag for headers.
Well, here is the final solution:
-
<?php wp_list_bookmarks(‘title_after=</h4>&title_before=<h4>’); ?>
Does it work fine? Look on the right side of this page. ;)
Bye :)










