Make use of Links in WordPress

If I had to point out one page in WordPress admin area that gets least attention and coverage that would probably be Links.

I don’t know how Links were envisioned or started, but when I first started using WordPress they seemed nothing more significant than minor tool to set up your blogroll. It might seem that they stuck like that, but in reality they had really moved on in functionality.

Link are (by definition) URLs to something, but they can also store additional data, such as:

  • description;
  • category;
  • XFN relation;
  • associated image;
  • associated RSS feed address.

It is no longer just a link, it is link to something, link that looks like something and link that comes with meta information.

Access by code

Links have their own function ,somewhat inconsistently named wp_list_bookmarks().

It accepts multiple options and allows to control:

  • which links are returned;
  • should they be split by categories;
  • how are they sorted;
  • what markup are they surrounded with.

Access by widget

Since writing code is overkill for many WordPress users, widget is much more convenient way. Native Links widget kinda works, but lacks in functionality.

I highly recommend to go for Bookmarks widget instead, which is available as part of Hybrid theme or separately in Widgets Reloaded plugin.

It allows to control output precisely and completely in graphical interface.

Example usage

I want to write some solid advertisement management for upcoming (almost done, honestly) new theme. It struck me that for some parts Links will do just fine. Essentially advertisement is image and link.

Took me minutes to create several links, add images and use Bookmarks widget to output them (randomly sorted for kicks).



Not a single line of PHP code, barely two lines of CSS to float images. And yes – they will probably be smaller for release. :)


There are many possible applications for Links – from advertisement to supplementary navigation. They are simple, flexible, easy to work with without writing code.

You only have to know they are there. Now you do. :)

Related Posts


  • donace #

    Your working on a new theme? Wow I've been sleeping a bit too long. Looking forward to see that. A question; you mentioned using it for ads etc. Now would it be possible to assign random (or even set) ads? For example in cat 1 which is about hosting it cycles through your hosting ads. Etc etc
  • Rarst #

    @donace Seriously?.. I am working on damn theme for over a year already. :) You can control amount and order of links per page load. So if you have 10 links in hosting category and set to fetch 4 with random order you will have 4 random ads on each page load.
  • Edward de Leau #

    They have their limits see e.g. my links on populair.eu: - for that you need hierarchical categories and (i havent shown this (yet)): - a meta dir with per link the alexa ranking, the su amount of pageviews, the delicious amount of entries so linksmeta the favicon can be retrieved via google but... you have to check when google returns the default favicon so you can set your own and of course you have to cache them on disk since not all browsers show these (hopefully cached) icons as inline.
  • donace #

    I've been away for a while man! Or didn't you notice :p Though yep sounds like a nice low resource solution, will test it out once time permits against oiopublisher
  • Rarst #

    @Edward de Leau Well, I said Links are useful, not that they are omnipotent. :) Building site like you linked to (cool one btw) with Links alone would be definitely pushing it. But not impossible if something else keeps track of top categories (for example post that holds Link categories in meta field and template that makes use of it). I wonder if Links would be converted to Custom Posts, that would make sense in the long run.
  • Edward de Leau #

    I've thinking a lot about that since I want to improve the "technical architecture" behind it. But... i think its different than the taxonomy behind custom posts or the taxonomies that you would want to build with it (im not sure) (although in reference terms in could be). Somewhere there is a list of all top level domains (iana). and we have a sort-of almost complete list of second level "official" domains (mozilla publicsuffix). these have further "unofficial domains" and on the other side they have relative paths. each specific uri has meta data. but the tree is a hierarchical tree consisting out of all uri's possible. Some of these are coupled to a meaning and some to some kind of ranking. What I did was first start with the official TLD's and give them level 0, the official second/third level i give level 1 with a parent linking back to the parent (e.g. co.uk links to uk). Then e.g. google.co.uk links back to co.uk. Also for relative domains some are "sort of" domains like the youtube.com/user root where all kinds of users have youtube movies. I also downloaded the Alexa top 1.000.000 file and loaded that in this database. That is needed because Alexa sometimes only indicates some top level domain with its ranking and not your specific link, so you have to crawl up the tree. And you might sometimes also want to know how many links to "youtube users" you have so you need to have some kind of root. To have this in 1.000.000+ custom posts as "init" would be not handy. So I loaded this in a reference database and just because this contain the exact uri, all the metadata, the icons, the rankings, comments on delicious and stumbleupon about that link etc... there is nothing more to "add" than a link to that page. But... inside wordpress you might have e.g. like me that link on a specific page (or more) and maybe you want to add your own review to some links. So you could enter this info in WordPress in custom fields linking to the reference database for publishing information to the client. Then again... the category you put these links in... is comparable to other taxonomies (e.g. dmoz) so it would be more of an advantage to also do the categorization in this outside table because then you could compare your categorization with e.g. the dmoz one or the tags delicious users have added to these links. In would then be as simple as "as soon as you have categorized it it means you want to have it show up in your WP blog". The only thing left is the review part of a specific uri (which will be some kind of parent uri in the external database e.g. "youtube"). I think only that reference (so a custom field with a regular non custom blogpost containing the database id of the specific parent uri) would be worth putting in WP. p.s. I have that code (its simple) unfortunately the database, after loading the 1.000.000 alexa sites is uhm... BIG (I tried sqlite at first but ... not a good idea). If anyone want to improve that code I would like to share it to improve it. (adding 1.000.000+ favicons in it also.... grows things.....) (slight problem there grin).
  • Rarst #

    @Edward de Leau Ouch, do you really need whole million? :) Custom posts or not, handling over million entries is not something that will "just work" in WordPress. Likely it is best kept in separate table (or even database) of fitting design. I do not want to even think about handling million favicons. Quantity of files alone would easily dismantle filesystem performance I think. Could work if packed in sprites (100x100 for example), but will take some decent code to handle. Shucks, I thought about it. :)
  • axel@id meneo #

    well I must confess it's much quicker to create links directly in the code. I use the link management only for clients but most don't really care about it.