Fixes for WordPress 2.1 Ella

Some of the themes are experiencing some errors in the codes after upgrading to wordpress 2.1 . The reason is wordpress has changed few codes like integrated links into category table. Unfortunately for some reason I will not be able to update all theme files on for few days. So for the time being, those who have the errors please correct it by changing this line …

Open the file where your links apear (most probably sidebar.php) and replace

$link_cats = $wpdb->get_results(”SELECT cat_id, cat_name FROM $wpdb->linkcategories”);


$link_cats = $wpdb->get_results(”SELECT cat_id, cat_name FROM $wpdb->categories WHERE link_count!=’0′”);

Then replace

<?php wp_get_links($link_cat->cat_id); ?>


<?php get_links($link_cat->cat_id, ‘<li>’, ‘</li>’, ‘<br />’, FALSE, ‘id’, FALSE, TRUE, -1, TRUE); ?>

February 6th, 2007
Tags :


  1. Hi,

    I am using DarkPad and this doesn’t to fix it for me.

    Am I missing something?



  2. Does it show the same error ? If so, Are you sure that you replaced and saved the file ?

  3. Thanks for getting back to me.

    I think so.

    I first tried it in WordPress theme editor, then I tried it in Dreamweaver and I got the same result. When I tried the new code, the right column disapeared altogether. I had to go back and re-enter the old code.


  4. Try this fix now.

  5. I’m using Darkpad as well, and I’m getting the same error as Steve. I tried the fix above, and the error remains. Not sure if I’m putting it in the correct place in sidebar.php. Here is the text of the error that appears in place of my links:

    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



  6. Okay, managed to get it working in DarkPad. Here’s what I had to do:

    in style.css add:

    .linkcat {

    In sidebar.php replace links code with:

  7. Sorry, it choked on the php tags.
    sidebar.php gets:

    ?php wp_list_bookmarks(); ?

    but all that surrounded by angle brackets.

  8. That fix doesn’t work either.


    works, albeit with improper formatting (unnecessary bullets at each category header, headers are in the wrong font).

  9. I don’t seem to be getting this. Uhm, can you elaborate on which line we have to replace? Thanks.

  10. I’m using Internet Broadcast and the sidebar got problem so how to fix it back to normal the themes… u can check with my website

    Please help me to fix it thank you!

  11. Thanks for your fix – I just upgraded last night and was having some trouble with this.
    I found another method, and I was on my way to solving it this way:

    &title_after='); ?>

    I was almost going to stick with that, as it seems a little cleaner method for displaying links, however there is a pesky little List Item dot prefixing the title that I couldn’t get rid of.
    Either method is fine.

  12. Thank you for the quick fix. I was worried I would have to switch back to the default theme but this worked like a charm for me.

    Thanks again for a great theme.

  13. I am also having trouble with links on the ‘Buryy’ theme. I tried the above methods but with no success. Upon editing the sidebar.php, my theme would no longer load at all. Any ideas what I’m doing wrong?

    Huge thanks in advance for the help and keep up the good work!

  14. Please download the theme again and replace the sidebar.php

  15. Thanks Sreejith, that fixed my problems.


  16. I redownloaded the DarkPad theme and it shows all of the sidebar as it’s supposed to, but now the descriptions are printed alongside the link. How can I remove them?

  17. Does not appear to be working for the internet marketing theme. Any info is appreciated. :(

  18. Ok, replaced the links code with the code from the ‘fixed’ theme you suggested to download again. ;)

  19. Hi, Sreejith,

    I love your DaVinci code theme. For an author of Historical fiction, it’s perfect.
    I have all the fixes in place on the sidebar as you suggested. But with a recent upgrade to WordPress 2.1.1, the layout broke. I cannot figure out how to fix. Have gone into every file I can access to edit. and even from my file manager, and on my Dreamweaver on my Mac.

    Cannot seem to fix it, and it stays the same even when I switch to the Taft Theme.

    I am in the process of redesigning my site: , but the WordPress is not public yet.

    Now they have a new Urgent upgrade to WordPress 2.1.2 but my Fantastico doesn’t offer it yet. just the 2.1.1, after which I started having problems with the layout.

    Any ideas?


  20. Uh, sorry. Thought my DaVinci Code wordpress site would show up:

    My DaVinci

    At the top, a bar of the regular background shows up. Can’t fix it.
    As above.

  21. Dont know if this helps, but I had a similar problem and fixed it quickly with this

    $link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);

    $link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->categories”);

  22. Rene again, Sreejith,

    I finally got the new wordpress 2.1.2 upgrade to my site, that is still not public, cuz it’s still broken.
    I downloaded Davinci again, deleted it on the site and reloaded the new download.

    I don’t know why, I was playing with some new plugins and suddenly the middle background image appears at top of the site, where it does not belong. When I change themes this does not happen.

    I did a screen shot and can send you that in an email, downsized for sending.


  23. sure you can send me the theme screenshot and theme files at me[dot]sreejith[at] . I will surely look into it .

  24. […] and MySQL database in MAMP. I found that the template I use needed a quick update (as detailed on GFXedit) but otherwise the upgrade script seems to have done the job without any trouble. Please let me […]

  25. Is there a way to keep the link descriptions from showing up on my blog? In the older versions showed up only when moused-over. In this version they show up under the link name. This takes up more space visually than I want it to. Thanks for any help you can supply!

  26. Shonnie,

    In sidebar.php, instead of

    <?php get_links($link_cat->cat_id, ‘<li>’, ‘</li>’,
    ‘<br />’, FALSE, ‘id’, TRUE, TRUE, -1, TRUE); ?>


    <?php get_links($link_cat->cat_id, ‘<li>’, ‘</li>’, ‘<br />’, FALSE, ‘id’, FALSE, TRUE, -1, TRUE); ?>

  27. Thanks Sreejith! That’s what I needed.

  28. Do you have any ideas how I can fix this error:

    WordPress database error: [Unknown column ‘link_count’ in ‘where clause’] SELECT cat_id, cat_name FROM wp_categories WHERE link_count!=’0′

    Everything shows up fine except for my blogroll and other links. Thanks for any help you can provide!

  29. Which version of WordPress are you using. Because in latest version 2.2.1 link_count table is there in wp_categories column.

    If you are using the latest version, then reinstall wp.

  30. Sorry to bug you, but I spent mucho time on the WordPress support forum last night trying to fix my blogroll.

    Okay, this is totally flipping me out. I’ve tried fixing the Blogroll code using:

    to replace

    but to no avail.

    I’ve got the exact same code (for sidebar links) shown here and while the fix seems to work for some people, I still get this crud:

    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

    What in the heck am I doing wrong?

    I also tried the above fix from your original post. I’m using the lightCMS theme, but the code seems identical.


  31. Oops. Forgot to remove the . Sorry for the above garble.

    I used ?php wp_list_bookmarks(); ? to replace ?php get_links_list(); ? in my sidebar.php code, but it didn’t work.

    I’ve tried every possible configuration (given my limited understanding of code). My link code is the same as

  32. Jesse, could you please use the contact form and mail me the problem.

Leave a comment »

Upcoming Themes

About GFXedit Designs

GFXedit Designs is the official website of Web Designer & Coder, Sreejith R Krishnan, with over five years commercial design experience as a freelance designer. Creating clear, simple, effective web designs with respects to latest web standards, personally and with help of a team of freelance designers.

The services range from web designs (PSD), XHTML/CSS coding, PHP, Content Management Systems, Static, Corporate & Blog themes with Wordpress etc.

Read more