WordPress.org

Ready to get started?Download WordPress

Forums

Links from the Links Manager (21 posts)

  1. dgstinner
    Member
    Posted 7 years ago #

    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'-->

  2. rtcunningham
    Member
    Posted 7 years ago #

    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.

  3. froman118
    Member
    Posted 7 years ago #

    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.

  4. rtcunningham
    Member
    Posted 7 years ago #

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

  5. dgstinner
    Member
    Posted 7 years ago #

    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.

  6. dgstinner
    Member
    Posted 7 years ago #

    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'-->

  7. rtcunningham
    Member
    Posted 7 years ago #

    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

  8. dgstinner
    Member
    Posted 7 years ago #

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

  9. rtcunningham
    Member
    Posted 7 years ago #

    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

  10. dgstinner
    Member
    Posted 7 years ago #

    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?

  11. mybaseb1
    Member
    Posted 7 years ago #

    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.

  12. rtcunningham
    Member
    Posted 7 years ago #

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

  13. rtcunningham
    Member
    Posted 7 years ago #

    @dgstinner,

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

  14. wallywonderswhy
    Member
    Posted 7 years ago #

    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.

  15. weschilders
    Member
    Posted 7 years ago #

    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?

  16. maitri
    Member
    Posted 7 years ago #

    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.

  17. froman118
    Member
    Posted 7 years ago #

    Here's the available documentation on the new wp_list_bookmarks function, http://codex.wordpress.org/Template_Tags/wp_list_bookmarks

  18. doharra
    Member
    Posted 7 years ago #

    So far -- I appear to have found a fix to the 2.1 upgrade-blogroll links problem on my Tiga theme site.

    I was having the same problem with the database error message mentioned above, with my links not showing up in the sidebar-widget on my Tiga theme. I finally solved it late last night (with lots of help from dozens of messages posted on the forums here) and cleaned it up today. I'm no programmer, but my site is now working (fingers crossed) and maybe my ordeal can be helpful or inspire a better solution by someone else.

    First, after messing around for hours and failing to get the sidebar widget to display the blogroll links, I tried Rtcunningham's very helpful fix outlined above. Though I had to tinker with the css to get it to match my site, it ended up creating an ingenious workaround. As long as the sidebarwidget plugin was turned OFF, I could get the blogroll links to appear in the Tiga sidebar more or less where I wanted them.

    Along with new css, the key for me was replacing the whole links manager section inside Tiga's sidebar.php file with the code from Rtcunningham:

    <!-- Begin - Links from the 'Links Manager' -->
    <div class="bookmarks">
    <?php wp_list_bookmarks(); ?>
    </div>
    <!-- End - Links from the 'Links Manager' -->

    This of course eliminated the code that seemed to be causing the problem after the 2.1 upgrade -- "...$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");..."

    It worked. But I wanted my widgets back! In the end, I could not give them up. (Is this a sign of addiction?) So I kept fumbling forward, reassured that I had a workaround if I couldn't figure it out.

    I wasted a lot of time messing with the "function widget_links($args)" section of the widgets.php file of the sidebarwidgets plugin, but I ended up leaving it alone. I also deleted all my links and categories and rebuilt them. It made no difference. And I reran the install too. Nothing helped.

    No matter what I did, when I reactivated the sidebar widgets plugin, I got the same database error message that mentioned the code I'd cut from the sidebar.php. I realized that meant some other file was making the illegal call, but I had no idea where to look.

    Then, something I read on another thread here made me go hunting through Tiga files line by line. And what do you know, I found the second bit of problem code in the tiga.php file.

    /* Links from the 'Links Manager' */
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name ..." AND SO ON.

    After backing up, I cut all of the links manager code until "Override the default 'Pages' widget" from this file. Left this section of the file totally blank. And saved it.

    Presto. My blogroll links began showing up in the sidebar widget again, right where I had dragged the "link" icon in the sidebar widgets management page. I think the wp_list_bookmarks() in the widgets.php file had taken over the same work as the instructions that I cut from the tiga.php file. But I really don't know.

    Of course, the links displayed by category but were messed up in appearance. So I checked the page source. It turned out the blogroll links and their categories had been given a class of "linkcat." (Where did that come from?) So, to make them line up properly inside the blue-white Tiga widget boxes, I added this code to my style.css file.

    .linkcat {
    width: 125px;
    text-align: center;
    padding:10px 5px;
    border-width:1px;
    border-style:solid;
    margin: 0 5px 5px 0;
    background-color:#FFFFFF;
    list-style-type:none;
    }
    .linkcat ul {
    list-style-type: none;
    padding:0px;
    margin:0px;
    }
    .linkcat li {
    text-align: center;
    }

    I don't know if this process can be generalized to other themes, but it worked on my Tiga site. Removing the old links code from two different files in the theme was the key, in my case. Plus a bunch of new css work. I hope this saves someone some time, or contributes to some snazzy fix from all the bull-goose WP programmers out there. Cheers.

  19. steve_lewis
    Member
    Posted 7 years ago #

    @froman118

    Two things:

    1. I havn't yet noticed any notes of "oops we messed up" or other noises of contrition over this from those who have more responsibility to keep track of these things. I haven't been looking that hard, however. Have the appropriate people acknowledged these problems with the incomplete release notes:
      • $wpdb->linkcategories is gone
      • the behavior of wp_list_cats has been broken
      • the behavior of list_cats has been broken

      all of this would have been good to mention to folks who were looking at upgrading. The fact that the "suddenly deprecated" (broken) methods cited above didn't have links to their new replacement methods at time of release makes the 2.1 launch look rushed.

    2. You probably know this but for completeness I wanted to add that the query fix you provided above is incomplete for front-end usage. The link_count column keeps track of how many 'bookmarks' (aka links) exist in a category. It does nothing to track which links are (in)visible. The new wp_list_bookmarks tag you reference supports this by using 'hide_invisible=true'.

    I hope these comments can be taken in a constructive and instructive way.

  20. Tfleming
    Member
    Posted 7 years ago #

    doharra -

    Can you summarize what one can do to fix the problem?

    thanks,
    tony

  21. mistressemilie
    Member
    Posted 6 years ago #

    Amazing how this problem hasn't been solved yet. I'm running WP 2.3.1 and just installed Tiga. After finding a great solution to the fact that Tiga's widgets don't work (go here for the easy fix: http://wordpress.pastebin.ca/523651), now the blogroll doesn't show up. Sigh.

Topic Closed

This topic has been closed to new replies.

About this Topic