• Hi,
    I’ve switched to WP2.1, but know I’m having some problems with the wp_get_links() functions. It usually returned a link list wrapped in
    [li][/li]-tags but now it doesn’t seem to do it anymore. I’m just getting the links in form of text separated by [/br].
    I’d still like to keep the list though. Is there a new alternative function in WP2.1 which still does that?

Viewing 10 replies - 1 through 10 (of 10 total)
  • wp_get_links has been deprecated. It has been replaced by wp_list_bookmarks. Unfortunately, there are a few problems with it. I am still trying to figure it out myself.

    However, wp_get_links should not work at all if you upgraded correctly. Did you upgrade per the usual instructions or did you do an overwrite?

    I correct myself, I misspoke. wp_get_links has not been deprecated. Simply changed. I understand the problem you are having. I just discovered it on my site. I am not sure as to the solution…

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The way Links used to work is that all links had a “before” and “after” bit associated with them. wp_get_links respected that, and if you had li and /li in the Links manager for those links, then that’s what got output.

    But Links aren’t the same as they used to be anymore. So wp_get_links no longer works quite the same way. While it’s not actually deprecated, it probably should be since it just ends up using the new “bookmarks” functions anyway.

    I’d switch to wp_list_bookmarks to do what you need it to do.

    Note that the codex is somewhat incomplete/incorrect. Hey, 2.1 is new, you know? 😉

    Specifically, the “before” and “after” parameters seems to be called “category_before” and “category_after” from my look through the actual code. If you can’t get before and after to work, add the “category_” in front of them. However, these default to li and /li, so you shouldn’t need to set them at all.

    Thread Starter shoryuken

    (@shoryuken)

    Thx. wp_list_bookmarks really looks promising. Unfortunately, it also displays the name of the bookmark category. Guess I’ll have to play with the parameters a bit and see what I can do.

    Note to self: Don’t write “know” for “now” ^^

    i checked it as well, looks good, but i’m a bit confused

    it gives an example of arguments, like
    <?php wp_list_bookmarks(‘categorize=1&category=2&before=<span>&after=</span>&show_images=1&show_description=0&orderby=url); ?>

    can you use parts of it (like only the category id part), or should all arguments be used if you just want to select category 1

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    You can just use parts of it. Anything you leave out gets defaults.

    hmm. i just tried using <?php wp_list_bookmarks(‘category=1’); ?> but then nothing shows

    My understanding is that, in 2.1, category links and blogroll links are intermingled. I can’t understand the reasoning for this, though — blogrolls are for links to other sites, while category links are for categories in the same blog.

    That would not seem to be user-friendly. If I want to see a blogroll, I want to see a blogroll. If I want to see categories for that blog, that’s what I want … that is, what else did this person write about, not what did anyone else write about somewhere else. Oh well. ::shrug::

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    No, that’s not entirely correct. Links are still links. It’s the link *groups* that are now categories.

    When you look at the Link Manager (now called “Blogroll”), it has a lot of links. Each of them is in some category. Those categories are now just mixed together with the normal post categories as well.

    @bee: Do you have any links actually in category number 1? Are you sure? Go to Manage->Categories and double check what you think the category ID is.

    @ Otto > Thanks, that was it.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wp_get_links missing li-tag in v2.1?’ is closed to new replies.