Support » Fixing WordPress » How to separate link categories

  • (I apologize if this has been asked and answered as I could not find it)

    With versions before 2.1, I could break up my links into separate categories. For example, I could have on a restaurant site — “food magazines” “food stores” “food this or that”. Then I’d have 3 sections of links with the appropriate title.

    With 2.1, I have just my Blogroll links and they all fall under one category, even if I give them their own category.

    And yes, I mean links, not posts.

    I’d like them to be listed randomly, not by name, but under their own link category. Is this possible?

    And, I figure someone will ask, so here is my code in my sidebar.php file

    (I can’t get the code to replicate properly so will break it down to several lines)

    ?php get_linksbyname(”, ‘

    li’, ‘/li

    ‘, ”, FALSE, ‘rand’, FALSE, FALSE, -1); ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hoping to earn some good kharma for my own problem, I’ll point you to the docs with a couple of suggestions. The information I am going to give you will show you what the parameters are and, unless you say otherwise, I am assuming that you know enough HTML to be able to take it from there. Please post another reply if you do not, or close the topic if this helps you fix things.

    I looked up get_linksbyname under the DOCS heading. You can find the details of any function by looking there. To solve your problem,

    • you can look at what the parameters mean
    • look at the WP 2.1 wp_list_cats tag that appears to be intended to replace it (but which does not seem to be as flexible)
    • look at wp_get_linksbyname function, possibly with an eye to manually listing each of the names separately and doing the formatting by hand
    • if you look up a few basic looping constructs (e.g., “for”) at to see how to create a loop that would let you have the flexibility for creating the formatting while still retaining the automated link-fetching, so that you would not have to change the page each time you added a link
    • just replace the whole get_linksbyname tag with a manually formatted manually created section

    If you are familiar with HTML and daunted by the complexities of trying to create HTML chunks to insert into a PHP function, the last option might be the easiest and most flexible–despite it’s “primitiveness”–especially if you do not often add links. (I know that I don’t.)

    I hope all of this formatting works, heh…

    I added this to my “favorites” link and I’ll keep an eye on it to see how much this helped you. Good luck.

    Thank you. HTML I know, PHP and I don’t get along. I’m unable to close threads since it’s JS and I don’t do JS, but will post if and when this works.

    Appreciate the help 🙂

    Well, I give up. The code isn’t html but php, and I’m not familiar enough with it to use it. Each time I try either nothing happens or it totally breaks my site.

    I really despise 2.1

    Well, I may have figured it out …. I’m not blonde, either.


    Ok I managed to make a separate entry for each link … studying one of the links you gave me, I copied my code but instead of leaving the name out, I added in the name, i.e. ‘nameoflink’

    The only issue now is it broke the bottom of my website pretty badly. I need to troubleshoot the footer and figure out why the bottom graphic broke

    You sound link you made the cardinal error of upgrading: no backup. If you have a reasonable web host that allows telnet sessions, do this to make a backup from now on before you upgrade:

    1. get puTTy (a quick google/scroogle will do it)
    2. if you are on a PC, go get 7zip or winzip (7zip is free and better in some ways)
    3. when you get into your site, go to the directory where wordpress hides (it sounds like this is your public_html directory)
    4. type tar c -z index.php wp*.php wp-* > archivename.tgz
    5. download the file for an extra copy–it never hurts to have two

    if you need to recover, get archivename.tgz back onto your server in the right directory

    1. puTTy back in
    2. type tar x archivename.tgz * 
    3. But that’s for next time… Glad you’re at least sort of “up and running”. If this problem is fixed, please go ahead and close it. Maybe one of the gurus will check the post and see my link above… 🙂

    There was no upgrade. This is a brand new site.

    It could help if you posted your site so we could see it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to separate link categories’ is closed to new replies.