Using wp_list_bookmarks in WordPress 2.1
It seems several things have caused various levels of consternation as people have upgraded their blogs to WordPress 2.1.
My main issue involved the use of wp_get_links.
In WordPress 2.1, there are significant changes to the way the Link Manager works:
- Any link management is now done through the Blogroll tab.
- ALL link categories are now kept in the same table as your blog categories
- Essentially, in WordPress 2.1 a category can have both posts and links.
- If you upgraded from a previous version, your link category ID’s will changed. If you used wp_get_links to dynamically populated various link lists and they are now empty, chances are the category id wp_get_links was pointing to either no longer exits or, because of the changes, does not have any links associated with it.
- Even changing your old wp_get_links commands to the right categories may not fix your problem. For some reason, the default behavior of wp_get_links no longer places <li> tags around each link.
- The replacement for wp_get_links seems to be wp_list_bookmarks
- wp_list_bookmarks is indeed more powerful – there are a lot more parameters to choose from
- Find out how to use wp_list_bookmarks
- Note: there are inaccuracies in the codex for wp_list_bookmarks. For example, you MUST enclose the whole string within the parenthese with single ticks: wp_list_bookmarks(‘all my parameters here’)
- Not every parameter seems to work. I am still trying to verify some issues. For example, wp_list_bookmarks includes the name of the category by default. This can be changed or turned off with the parameter title_li. However, I have been unable to get it to work. I will update this post if I find out the reason.
As way of example, here is how I am using wp_list_bookmarks to call a menu on my site:
<ul>
<?php wp_list_bookmarks('title_before=&title_after=&
categorize=1&category=52'); ?>
</ul>
This code produces this:
The nulls for title_before and title_after remove the default <h2> tag that occurs before and after the category title.
categorize=1 ensures the category name is display. If set to zero, the generic “Bookmarks” appears.
category=52 grabs the links associated with that category.
Like I mentioned above, I am still trying to figure out how the title_li parameter works.
If you have any questions please leave them below.
Posted by Paul Flyer on Wednesday, January 24th, 2007 in WordPress Help




dudi Says:
January 24th, 2007 at 4:00 pm
ups, sorry for my comments at other post
, just delete it and try this one :
<?php wp_get_links(‘category=52&before=<li>&after=</li>’); ?>
#!/Dudi/Gurnadi » wp_get_links() di Wordpress 2.1 Says:
January 25th, 2007 at 12:27 am
[...] Jika tidak ingin menggunakan fungsi wp_get_links(), maka dapat dilakukan dengan cara menggunakan wp_list_bookmarks(‘args’) seperti panduan dari recommended web tools. [...]
PalabrerÃÂo » En Ella Says:
January 29th, 2007 at 10:59 am
[...] ajuste que tuve que hacer fue para los links que ahora se llaman blogroll. Bueno ahí tuve que cambiar en el template de ‘wpgetlinks’ a ‘wplistbookmarks’ y argumentarlo. Ahora hay más [...]
Cato Says:
February 6th, 2007 at 2:47 am
How can I remove the title of the link category?
Paul Flyer Says:
February 7th, 2007 at 12:46 pm
Cato, the title of the link category is removed with the title_li parameter. I have not been able to get it to work. I’ve tried every which way and I don’t think the wordpress code is totally correct. From the WordPress Codex:
title_li
(string) Text for the heading of the Page list. Defaults to ‘__(‘Bookmarks’)', which displays “Bookmarks” (the __(”) is used for localization purposes). If passed a null or empty value (”), no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags.
Patrick Austin Says:
February 10th, 2007 at 3:54 pm
Hi Paul, check out this link…
http://wordpress.org/support/topic/102345
Bob Says:
February 13th, 2007 at 8:33 pm
Hey,
I read this great post before solving the problem, so I’ll paste this link I found:
* http://trac.wordpress.org/ticket/3664
If you apply the bug fix yourself to bookmark_template.php, title_li starts working again!
Best,
Bob
HOW’s SketchBook » Blog Archive » [Wordpress] çâ€Â¨Ã¤Â¸â€¹Ã¦â€¹â€°Ã¥Â¼Â表單整ç†è½è½長的blogroll連çµÂ清單 Says:
February 19th, 2007 at 3:28 am
[...] WordPress 2.0以後,多了個新的書籤整ç†函å¼Â。原來是çâ€Â¨get_link()來讀å–連çµÂ清單,ç¾在多了wp_list_bookmarks()å¯以çâ€Â¨Ã£â‚¬â€šÃ¥Å Ÿèƒ½æ›´å¼·ï¼Œä¹Ÿæ›´å®¹æ˜“æ ¼å¼Â化。因為有了標準的格å¼Â化è¦Â格,因æÂ¤å°±å¯以動點手腳,讓他å¯以輕鬆轉æÂ›æˆÂ下拉å¼Â表單。 [...]
wp_get_links() di Wordpress 2.1 « Dana Ahmad Weblog Says:
November 1st, 2007 at 1:58 am
[...] Jika tidak ingin menggunakan fungsi wp_get_links(), maka dapat menggunakan fungsi wp_list_bookmarks(‘args’) seperti panduan dari recommended web tools. [...]