Support » Fixing WordPress » Links from the Links Manager

  • I’m using the Tiga theme and it has the following code to pull in my links (which are now under Blogroll in WP2.1). What do I need to change in the following code to make it display properly in WP2.1?

    <!-- Begin - Links from the 'Links Manager'-->
    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    if (get_links($link_cat->cat_id, '', '', '', FALSE, '', FALSE, FALSE, -1, FALSE, FALSE)) {
    ?>
    <div class="left-widget-title"
    id="linkcat-<?php echo $link_cat->cat_id; ?>">
    <?php echo $link_cat->cat_name; ?>
    </div>
    <div class="left-widget">
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </div>
    <?php
    }
    }
    ?>
    <!-- End - Links from the 'Links Manager'-->

Viewing 15 replies - 1 through 15 (of 20 total)
  • I have the same problem with the Tiga theme. I’m not a PHP noob, but I’m not familiar with the changes at all.

    Try replacing the text of that SQL query with the following:

    SELECT * FROM $wpdb->categories where link_count > 0

    The linkcategories table went bye bye in 2.1 so I’m expecting to see this question pop up a lot.

    Tried it. New error popped up: Unknown column ‘link_’ in ‘order clause

    Does anyone have a working solution? If I use <?php get_links_list(); ?> which works on one of my other themes, it breaks the page.

    This code seems to work but if anyone can suggest something better, please let me know.
    <!-- Begin - Links from the 'Links Manager'-->
    <div class="left-widget-title"><?php _te('My Other Sites'); ?></div>
    <div class="left-widget"><?php get_links(19, '<li>', '</li>', '', TRUE, 'url', FALSE); ?></div>
    <!-- End - Links from the 'Links Manager'-->

    Change the part of the theme to this:
    <div class=”bookmarks”>
    <?php wp_list_bookmarks(); ?>
    </div>

    Then add CSS to styles.php to alter the contents. I used this, although some of it is overkill, but I don’t have time to tweak it:

    .bookmarks {
    border-color:<?php tiga_widgetBorderColor(LEFT); ?>;
    width:<?php tiga_leftWidgetWidth(); ?>px;
    border-width:1px 1px 1px 1px;
    border-style:solid;
    color:#000000;
    background-color:#FFFFFF;
    padding:0px 5px 5px 5px;
    margin-top: 0px;
    margin-bottom:5px;
    }
    .bookmarks h2{
    <?php tiga_bgImage(‘leftWidgetTitle’); ?>
    <?php tiga_bgImage(‘leftWidgetTitle’); ?>
    border-color:<?php tiga_widgetBorderColor(LEFT); ?>;
    color:<?php tiga_widgetTitleFontColor(LEFT); ?>;
    background-color:<?php tiga_widgetTitleBgColor(LEFT); ?>;
    border-width:0px 0px 1px 0px;
    border-style:solid;
    font-size:9pt;
    font-weight: bold;
    padding:5px;
    margin:-0px -5px 5px;
    }
    .bookmarks li{
    list-style: none;
    margin-bottom:5px;
    }
    .bookmarks ul{
    list-style-type:none;
    padding-left:7px;
    margin-top:0px;
    margin-left:0px;
    }

    If anyone has better CSS or a better idea, please send email to me: ninong1@gmail.com

    That breaks my page and only the left sidebar shows up.

    It shouldn’t break anything. It doesn’t change the existing CSS and you’re only replacing a single block of code in sidebar.php

    What’s weird is it works perfectly fine on one of my blogs but not the other and I installed WP 2.1 the same way on both. I deleted every file, uploaded 2.1 and ran upgrade.php. Shouldn’t upgrade.php tell you when running it won’t do anything?

    I upgraded to wordpress 2.1 tonight and received the following error message where my blogroll links usually are:

    “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”

    I just can’t figure out how you guys did this above.

    Please help quickly.

    I’ll be glad to help. Send me email at ninong1@gmail.com so that I can send the changes to you directly.

    @dgstinner,

    You got me on that one. I’ve seen some weird stuff happen.

    I had unsolved minor issues with Tiga and links for awhile now and after the upgrade they really didn’t work. I switched to Anaconda theme and everything worked without issue.

    This code worked to remove the error messages I was receiving

    <?php wp_list_bookmarks(); ?>

    I’m even specifying a category of link to display with:

    <?php wp_list_bookmarks(1); ?>

    The only problem is that it now displays the category name as an h2 before the ul that displays the links. Is there a way to prevent this?

    Also… is there somewhere to find documentation specific to version 2.1?

    Have you tried running the WP upgrade? I had the same issues when refreshing my page before running the upgrade. Once the upgrade took, all the kinks ironed themselves out.

    The other option is simply to delete all of your core files and reinstall WP.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Links from the Links Manager’ is closed to new replies.