Mastering the WordPress Links Manager API

Originally published at: http://www.sitepoint.com/mastering-wordpress-links-manager-api/

In a previous article, we saw what the WordPress Links Manager is, how to access it, and how to use it to manage a sorted list of links. We also learnt how to display our links, thanks to the default widget.

However, this widget is not perfect: while it is more than enough to display a basic blogroll, we can’t do all we want to do with it. In the next two articles, we will see how to use the Links Manager API to display our links. In this article, we will focus on describing the main function of the API, before learning how to use the other functions in the next article.

A Function to List Our Links

We find several functions in the Links Manager API. However, we won’t use all of them. In fact, if you have already seen some code that uses this API, you might also have seen the use of one the following three functions: get_links(), get_links_list() and wp_get_links(). You shouldn’t use these functions: they are all deprecated.

The function we will study in this article is wp_list_bookmarks(). All it does is display your links in the shape of a list, but some options allow us to customize the result and that’s why this function is so interesting.

Basically, you can use the wp_list_bookmarks() function without giving it any argument. It will then display all the categories, one after another. For each of these categories, it displays an unordered list with the different links with their image. Without any customization in the wp_list_bookmarks() function or even in the CSS, we see the result below.

Continue reading this article on SitePoint

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.